Package org.fluxtream.core.connectors

Examples of org.fluxtream.core.connectors.Connector


        }
    return "redirect:/app/from/" + connector().getName();
  }

  private Connector connector() {
    Connector fitbitConnector = Connector.getConnector("fitbit");
    return fitbitConnector;
  }
View Full Code Here


    @Override
    public List<TimespanModel> getTimespans(final long startMillis, final long endMillis, final ApiKey apiKey, final String channelName) {
        List<TimespanModel> items = new ArrayList<TimespanModel>();
        final TimeInterval timeInterval = new SimpleTimeInterval(startMillis, endMillis, TimeUnit.ARBITRARY, TimeZone.getTimeZone("UTC"));
        Connector connector = apiKey.getConnector();

        // Sadly, the start and end times of twitter facets are the same.  Assume that the
        // start time is correct and arbitrarily draw a box that's 1 mins or
        // 1/256 of the tile width, whichever is larger.
        long duration = Math.max((endMillis-startMillis)/256L, 60000L);

        //TODO: support merging
        for (ObjectType objectType : connector.objectTypes()) {
            String objectTypeName = apiKey.getConnector().getName() + "-" + objectType.getName();
            List<AbstractFacet> objectTypeFacets = getFacetsInTimespan(timeInterval,apiKey, objectType);

            for (AbstractFacet facet : objectTypeFacets){
                items.add(new TimespanModel(facet.start, facet.start+duration, channelName, objectTypeName));
View Full Code Here

        return items;
    }

    @Override
    public List<AbstractFacetVO<AbstractFacet>> getFacetVOs(final GuestSettings guestSettings, final ApiKey apiKey, final String objectTypeName, final long start, final long end, final String value) {
        Connector connector = apiKey.getConnector();

        TimeInterval timeInterval = metadataService.getArbitraryTimespanMetadata(apiKey.getGuestId(), start, end).getTimeInterval();

        final ObjectType objectType = ObjectType.getObjectType(connector, value);
View Full Code Here

    private void storeV1MeasureGroup(final UpdateInfo updateInfo, final JSONObject measuregrp) throws Exception {
        final long date = measuregrp.getLong("date")*1000;
        JSONArray measures = measuregrp.getJSONArray ("measures");

        final Connector connector = Connector.getConnector("withings");

        Iterator measuresIterator = measures.iterator();
        final Map<Integer, Float> measuresMap = new HashMap<Integer, Float>();
        while(measuresIterator.hasNext()) {
            JSONObject measure = (net.sf.json.JSONObject) measuresIterator.next();
View Full Code Here

        String verifier = request.getParameter("oauth_verifier");
        provider.retrieveAccessToken(consumer, verifier);

        Guest guest = AuthHelper.getGuest();

        Connector connector = Connector.getConnector("withings");

        ApiKey apiKey;
        if (request.getSession().getAttribute(WITHINGS_RENEWTOKEN_APIKEYID)!=null) {
            final String apiKeyIdString = (String) request.getSession().getAttribute(WITHINGS_RENEWTOKEN_APIKEYID);
            long apiKeyId = Long.valueOf(apiKeyIdString);
View Full Code Here

    @Autowired
    GuestService guestService;

    public Map<String,Object> createConnectorInstanceModel(ApiKey apiKey) {
        Map<String,Object> model = new HashMap<String,Object>();
        final Connector connector = apiKey.getConnector();
        final Map<String, String> attributes = guestService.getApiKeyAttributes(apiKey.getId());
        model.put("connectorName", connector.getName());
        model.put("attributes", attributes);
        String rateLimitString = (String) env.connectors.getProperty(connector.getName()
                                                                     + ".rateLimit");
        if (rateLimitString == null)
            rateLimitString = (String) env.connectors.getProperty("rateLimit");
        model.put("rateLimitSpecs", rateLimitString);
        final String auditTrail = checkForErrors(apiKey);
View Full Code Here


        fromFacet(facet, timeInterval, settings);
        ResourceBundle res = ResourceBundle.getBundle("facetSharing");
        final ArrayList<String> openGraphSharableFacets = new ArrayList(Arrays.asList(res.getString("opengraph").split(",")));
        final Connector connector = Connector.fromValue(facet.api);
        String facetName = String.format("%s.%s", connector.getName(), ObjectType.getObjectType(connector, facet.objectType));
        if (openGraphSharableFacets.contains(facetName)&&isShareable(facet)) {
            String encryptedUrl = settings.config.encrypt(String.format("%s/%s/%s", facet.api, facet.objectType, String.valueOf(id)));
            try {
                encryptedUrl = URLEncoder.encode(encryptedUrl, "UTF-8");
            } catch (UnsupportedEncodingException e) {}
View Full Code Here

    public SortedSet<String> getTags() {
        return new TreeSet<String>(tags);
    }

    protected void getType(T facet) {
    Connector connector = Connector.fromValue(facet.api);
    this.type = connector.getName();
    if (facet.objectType != -1) {
            final String objectTypeName = getObjectTypeName(facet);
            this.type += "-" + objectTypeName;
    }
    this.subType = getSubtype(facet);
View Full Code Here

        timeUpdated = System.currentTimeMillis();
        start = photo.getCaptureTimeMillisUtc();
        end = start;
        hash = photo.getPhotoHash();

        final Connector connector = Connector.getConnector("fluxtream_capture");
        this.api = connector.value();
        this.objectType = ObjectType.getObjectType(connector, "photo").value();

        captureYYYYDDD = photo.getCaptureYYYYDDD();

        imageType = photo.getImageType().getFileExtension();
View Full Code Here

TOP

Related Classes of org.fluxtream.core.connectors.Connector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.