Package org.fluxtream.core.connectors

Examples of org.fluxtream.core.connectors.Connector


            JSONObject jsonToken = JSONObject.fromObject(tokenJSON);

            String accessToken = jsonToken.getString("access_token");
            String account = jsonToken.getString("account");

            final Connector connector = Connector.getConnector("github");
            final ApiKey apiKey = guestService.createApiKey(guest.getId(), connector);

            guestService.setApiKeyAttribute(apiKey, "accessToken", accessToken);
            guestService.setApiKeyAttribute(apiKey, "account", account);
View Full Code Here


    params.put("grant_type", "authorization_code");
   
    String fetched = HttpUtils.fetch(swapTokenUrl, params);
   
    JSONObject token = JSONObject.fromObject(fetched);
    Connector scopedApi = Connector.getConnector("foursquare");
    Guest guest = AuthHelper.getGuest();

        final ApiKey apiKey = guestService.createApiKey(guest.getId(), scopedApi);

    guestService.setApiKeyAttribute(apiKey,
        "accessToken", token.getString("access_token"));
   
    return "redirect:/app/from/"+scopedApi.getName();
  }
View Full Code Here

    OAuthProvider provider = (OAuthProvider) request.getSession().getAttribute(FRESHBOOKS_OAUTH_PROVIDER);
    String verifier = request.getParameter("oauth_verifier");
    provider.retrieveAccessToken(consumer, verifier);
    Guest guest = AuthHelper.getGuest();

        final Connector connector = Connector.getConnector("freshbooks");
        final ApiKey apiKey = guestService.createApiKey(guest.getId(), connector);

    guestService.setApiKeyAttribute(apiKey, "accessToken", consumer.getToken());
    guestService.setApiKeyAttribute(apiKey, "tokenSecret", consumer.getTokenSecret());

    return "redirect:/app/from/"+connector.getName();
  }
View Full Code Here

    JSONObject token = JSONObject.fromObject(fetched);
   
//    String scope = (String) request.getSession().getAttribute("oauth2Scope");
    Guest guest = AuthHelper.getGuest();

        final Connector connector = Connector.getConnector("instagram");
        final ApiKey apiKey = guestService.createApiKey(guest.getId(), connector);

    guestService.setApiKeyAttribute(apiKey,
        "accessToken", token.getString("access_token"));
   
    JSONObject userObject = token.getJSONObject("user");

        guestService.setApiKeyAttribute(apiKey, "id", userObject.getString("id"));
    guestService.setApiKeyAttribute(apiKey,
      "username", userObject.getString("username"));
    guestService.setApiKeyAttribute(apiKey,
      "full_name", userObject.getString("full_name"));
    guestService.setApiKeyAttribute(apiKey,
      "profile_picture", userObject.getString("profile_picture"));

    return "redirect:/app/from/"+connector.getName();
  }
View Full Code Here

    if (userid==null) {
      mav.setViewName("connectors/toodledo/error");
      return mav;
    }

        final Connector connector = Connector.getConnector("toodledo");
        final ApiKey apiKey = guestService.createApiKey(guestId, connector);

    guestService.setApiKeyAttribute(apiKey, "email", email);
    guestService.setApiKeyAttribute(apiKey, "password", password);
    guestService.setApiKeyAttribute(apiKey, "userid", userid);
View Full Code Here

    @RequestMapping(value = "/setToken")
    public String getToken(@RequestParam("token") String token,
                           @RequestParam("username") String username) throws IOException {
        Guest guest = AuthHelper.getGuest();
        final Connector connector = Connector.getConnector("quantifiedmind");
        final ApiKey apiKey = guestService.createApiKey(guest.getId(), connector);
        guestService.setApiKeyAttribute(apiKey,
                                        "token", token);
        guestService.setApiKeyAttribute(apiKey,
                                        "username", username);
View Full Code Here

    @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();
        String[] objectTypeNameParts = objectTypeName.split("-");
        ObjectType objectType = null;
        for (ObjectType ot : connector.objectTypes()){
            if (ot.getName().equals(objectTypeNameParts[1])){
                objectType = ot;
                break;
            }
        }
View Full Code Here

    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();
        String[] objectTypeNameParts = objectTypeName.split("-");
        ObjectType objectType = null;
        for (ObjectType ot : connector.objectTypes()){
            if (ot.getName().equals(objectTypeNameParts[1])){
                objectType = ot;
                break;
            }
        }
View Full Code Here

            return;
        }
        final JSONArray trackPoints = activityData.getJSONArray("trackPoints");
        List<LocationFacet> locationFacets = new ArrayList<LocationFacet>();
        // timeZone is computed based on first location for each batch of trackPoints
        Connector connector = Connector.getConnector("moves");
        for (int i=0; i<trackPoints.size(); i++) {
            JSONObject trackPoint = trackPoints.getJSONObject(i);
            LocationFacet locationFacet = new LocationFacet(updateInfo.apiKey.getId());
            locationFacet.latitude = (float) trackPoint.getDouble("lat");
            locationFacet.longitude = (float) trackPoint.getDouble("lon");
            // The two lines below would calculate the timezone if we cared, but the
            // timestamps from Moves are already in GMT, so don't mess with the timezone
            //if (timeZone==null)
            //    timeZone = metadataService.getTimeZone(locationFacet.latitude, locationFacet.longitude);
            final DateTime time = localTimeStorageFormat.parseDateTime(trackPoint.getString("time"));
            locationFacet.timestampMs = time.getMillis();
            locationFacet.api = connector.value();
            locationFacet.start = locationFacet.timestampMs;
            locationFacet.end = locationFacet.timestampMs;
            locationFacet.source = LocationFacet.Source.MOVES;
            locationFacet.apiKeyId = updateInfo.apiKey.getId();
            locationFacet.uri = activityId;
View Full Code Here

        final String token = accessToken.getToken();

        Guest guest = AuthHelper.getGuest();

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

        ApiKey apiKey;
        if (request.getSession().getAttribute(EVERNOTE_RENEWTOKEN_APIKEYID)!=null) {
            final String apiKeyIdString = (String) request.getSession().getAttribute(EVERNOTE_RENEWTOKEN_APIKEYID);
            long apiKeyId = Long.valueOf(apiKeyIdString);
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.