Package org.fluxtream.core.domain

Examples of org.fluxtream.core.domain.ConnectorInfo


                                                                             ? UpdateType.INCREMENTAL_UPDATE
                                                                             : UpdateType.INITIAL_HISTORY_UPDATE,
                                     updateTime);
        } else {
            int[] objectTypeValues = apiKey.getConnector().objectTypeValues();
            ConnectorInfo connectorInfo = null;
            String connectorName = "unknown";
            try {
                connectorInfo = systemService.getConnectorInfo(apiKey.getConnector().getName());
                connectorName = connectorInfo.connectorName;
            }
View Full Code Here


     *                        ALREADY_SCHEDULED
     */
    private void scheduleObjectTypeUpdate(final ApiKey apiKey, int objectTypes,
                                          List<ScheduleResult> scheduleResults,
                                          UpdateType updateType, long timeScheduled) {
        ConnectorInfo connectorInfo = null;
        try {
            connectorInfo = systemService.getConnectorInfo(apiKey.getConnector().getName());
        }
        catch (Throwable e) {
            // This connector is not in Connector info; skip it
View Full Code Here

        for (ApiKey key : connectors) {
            // Make sure the connector is of a type which is still supported.  Otherwise
            // skip trying to update it.
            try {
                if (key != null && key.getConnector() != null) {
                    final ConnectorInfo connectorInfo = systemService.getConnectorInfo(key.getConnector().getName());
                    // Make sure that this connector type supports sync and is enabled in this Fluxtream instance
                    if (connectorInfo.supportsSync && connectorInfo.enabled && key.getStatus() != ApiKey.Status.STATUS_PERMANENT_FAILURE) {
                        List<ScheduleResult> updateRes = updateConnector(key, force, updateTime);
                        scheduleResults.addAll(updateRes);
                    }
View Full Code Here

        // end up returning an incomplete list of connectors if this is
        // called during a thread other than the one in onApplicationEvent during startup
        //if (all.size() == 0) {
        //    resetConnectorList();
        //}
        final ConnectorInfo connectorInfo = JPAUtils.findUnique(em, ConnectorInfo.class, "connector.byName", connectorName);
        return connectorInfo;
    }
View Full Code Here

        int order = 0;
        String release = env.get("release");

        final String jawboneUp = "Jawbone UP";
        String[] jawboneUpKeys = checkKeysExist(jawboneUp, Arrays.asList("jawboneUp.client.id", "jawboneUp.client.secret", "jawboneUp.validRedirectURL"));
        final ConnectorInfo jawboneUpConnectorInfo = new ConnectorInfo(jawboneUp,
                                                                      "/" + release + "/images/connectors/connector-up.png",
                                                                      res.getString("up"),
                                                                      "/up/token",
                                                                      Connector.getConnector("up"), order++, jawboneUpKeys!=null,
                                                                      false, true, jawboneUpKeys);
        jawboneUpConnectorInfo.supportsRenewTokens = true;
        jawboneUpConnectorInfo.renewTokensUrlTemplate = "up/token?apiKeyId=%s";
        em.persist(jawboneUpConnectorInfo);

        final String evernote = "Evernote";
        String[] evernoteKeys = checkKeysExist(evernote, Arrays.asList("evernoteConsumerKey", "evernoteConsumerSecret", "evernote.sandbox"));
        final ConnectorInfo evernoteConnectorInfo = new ConnectorInfo(evernote,
                                                                      "/" + release + "/images/connectors/connector-evernote.jpg",
                                                                      res.getString("evernote"),
                                                                      "/evernote/token",
                                                                      Connector.getConnector("evernote"), order++, evernoteKeys!=null,
                                                                      false, true, evernoteKeys);
        evernoteConnectorInfo.supportsRenewTokens = true;
        evernoteConnectorInfo.renewTokensUrlTemplate = "evernote/token?apiKeyId=%s";
        em.persist(evernoteConnectorInfo);

        final String facebook = "Facebook";
        String[] facebookKeys = checkKeysExist(facebook, Arrays.asList("facebook.appId", "facebook.appSecret"));
        final ConnectorInfo facebookConnectorInfo = new ConnectorInfo(facebook,
                                                                      "/" + release + "/images/connectors/connector-facebook.jpg",
                                                                   res.getString("facebook"),
                                                                   "/facebook/token",
                                                                   Connector.getConnector("facebook"), order++, facebookKeys!=null,
                                                                   false, false, facebookKeys);
        em.persist(facebookConnectorInfo);
        final String moves = "Moves";
        String[] movesKeys = checkKeysExist(moves, Arrays.asList("moves.client.id", "moves.client.secret", "moves.validRedirectURL", "foursquare.client.id", "foursquare.client.secret"));
        final ConnectorInfo movesConnectorInfo = new ConnectorInfo(moves,
                                                                   "/" + release + "/images/connectors/connector-moves.jpg",
                                                                   res.getString("moves"),
                                                                   "/moves/oauth2/token",
                                                                   Connector.getConnector("moves"), order++, movesKeys!=null,
                                                                   false, true, movesKeys);

        movesConnectorInfo.supportsRenewTokens = true;
        movesConnectorInfo.renewTokensUrlTemplate = "moves/oauth2/token?apiKeyId=%s";
        em.persist(movesConnectorInfo);
        final String latitude = "Google Latitude";
        String[] latitudeKeys = checkKeysExist(latitude, Arrays.asList("google.client.id", "google.client.secret"));
        final ConnectorInfo latitudeConnectorInfo = new ConnectorInfo(latitude,
                                                                      "/" + release + "/images/connectors/connector-google_latitude.jpg",
                                                                      res.getString("google_latitude"),
                                                                      "upload:google_latitude",
                                                                      Connector.getConnector("google_latitude"), order++, latitudeKeys!=null,
                                                                      true, false, latitudeKeys);
        latitudeConnectorInfo.supportsRenewTokens = false;
        latitudeConnectorInfo.renewTokensUrlTemplate = "google/oauth2/%s/token?scope=https://www.googleapis.com/auth/latitude.all.best";
        em.persist(latitudeConnectorInfo);
        final String fitbit = "Fitbit";
        String[] fitbitKeys = checkKeysExist(fitbit, Arrays.asList("fitbitConsumerKey", "fitbitConsumerSecret"));
        final ConnectorInfo fitbitConnectorInfo = new ConnectorInfo(fitbit, "/images/connectors/connector-fitbit.jpg", res.getString("fitbit"), "/fitbit/token", Connector.getConnector("fitbit"), order++, fitbitKeys != null, false, true, fitbitKeys);
        fitbitConnectorInfo.supportsRenewTokens = true;
        fitbitConnectorInfo.renewTokensUrlTemplate = "fitbit/token?apiKeyId=%s";
        em.persist(fitbitConnectorInfo);
        final String bodyMedia = "BodyMedia";
        String[] bodymediaKeys = checkKeysExist(bodyMedia, Arrays.asList("bodymediaConsumerKey", "bodymediaConsumerSecret"));
        final ConnectorInfo bodymediaConnectorInfo = new ConnectorInfo(bodyMedia,
                                                                       "/" + release + "/images/connectors/connector-bodymedia.jpg",
                                                                       res.getString("bodymedia"),
                                                                       "/bodymedia/token",
                                                                       Connector.getConnector("bodymedia"), order++, bodymediaKeys!=null,
                                                                       false, true, bodymediaKeys);
        bodymediaConnectorInfo.supportsRenewTokens = true;
        bodymediaConnectorInfo.renewTokensUrlTemplate = "bodymedia/token?apiKeyId=%s";
        em.persist(bodymediaConnectorInfo);

        final String withings = "Withings";
        String[] withingsKeys = checkKeysExist(withings, Arrays.<String>asList("withingsConsumerKey", "withingsConsumerSecret"));
        final ConnectorInfo withingsConnectorInfo = new ConnectorInfo(
                withings, "/" + release + "/images/connectors/connector-withings.jpg",
                res.getString("withings"), "/withings/token",
                Connector.getConnector("withings"), order++, withingsKeys != null,
                false, true, withingsKeys);
        withingsConnectorInfo.supportsRenewTokens = true;
        withingsConnectorInfo.renewTokensUrlTemplate = "withings/token?apiKeyId=%s";
        em.persist(withingsConnectorInfo);

        final String zeo = "Zeo";
        String[] zeoKeys = checkKeysExist(zeo, new ArrayList<String>());
        // Zeo no longer supports sync.  The myzeo servers were disabled due to bankruptcy in May/June 2013
        em.persist(new ConnectorInfo(zeo,
                                     "/" + release + "/images/connectors/connector-zeo.jpg",
                                     res.getString("zeo"),
                                     "ajax:/zeo/enterCredentials",
                                     Connector.getConnector("zeo"), order++, zeoKeys!=null,
                                     false, false, zeoKeys));
        final String mymee = "Mymee";
        em.persist(new ConnectorInfo(mymee,
                                     "/" + release + "/images/connectors/connector-mymee.jpg",
                                     res.getString("mymee"),
                                     "ajax:/mymee/enterAuthInfo",
                                     Connector.getConnector("mymee"), order++, true,
                                     false, true, null));
        final String quantifiedMind = "QuantifiedMind";
        String[] quantifiedMindKeys = checkKeysExist(quantifiedMind, new ArrayList<String>());
        em.persist(new ConnectorInfo(quantifiedMind,
                                     "/" + release + "/images/connectors/connector-quantifiedmind.jpg",
                                     res.getString("quantifiedmind"),
                                     "ajax:/quantifiedmind/getTokenDialog",
                                     Connector.getConnector("quantifiedmind"), order++, quantifiedMindKeys!=null,
                                     false, true, quantifiedMindKeys));
        final String flickr = "Flickr";
        String[] flickrKeys = checkKeysExist(flickr, Arrays.asList("flickrConsumerKey", "flickrConsumerSecret", "flickr.validRedirectURL"));
        final ConnectorInfo flickrConnectorInfo = new ConnectorInfo(flickr, "/" + release + "/images/connectors/connector-flickr.jpg", res.getString("flickr"), "/flickr/token", Connector.getConnector("flickr"), order++, flickrKeys != null, false, true, flickrKeys);
        flickrConnectorInfo.supportsRenewTokens = true;
        flickrConnectorInfo.renewTokensUrlTemplate = "flickr/token?apiKeyId=%s";
        em.persist(flickrConnectorInfo);
        final String googleCalendar = "Google Calendar";
        String[] googleCalendarKeys = checkKeysExist(googleCalendar, Arrays.asList("google.client.id", "google.client.secret"));
        final ConnectorInfo googleCalendarConnectorInfo =
                new ConnectorInfo(googleCalendar,
                                  "/" + release + "/images/connectors/connector-google_calendar.jpg",
                                  res.getString("google_calendar"),
                                  "/google/oauth2/token?scope=https://www.googleapis.com/auth/calendar.readonly",
                                  Connector.getConnector("google_calendar"),
                                  order++, googleCalendarKeys != null, false, true, googleCalendarKeys);
        googleCalendarConnectorInfo.supportsRenewTokens = true;
        googleCalendarConnectorInfo.renewTokensUrlTemplate = "google/oauth2/%s/token?scope=https://www.googleapis.com/auth/calendar.readonly";
        em.persist(googleCalendarConnectorInfo);
        final String lastFm = "Last fm";
        String[] lastFmKeys = checkKeysExist(lastFm, Arrays.asList("lastfmConsumerKey", "lastfmConsumerSecret"));
        final ConnectorInfo lastfmConnectorInfo = new ConnectorInfo(lastFm, "/" + release + "/images/connectors/connector-lastfm.jpg", res.getString("lastfm"), "/lastfm/token", Connector.getConnector("lastfm"), order++, lastFmKeys != null, false, true, lastFmKeys);
        lastfmConnectorInfo.supportsRenewTokens = true;
        lastfmConnectorInfo.renewTokensUrlTemplate = "lastfm/token?apiKeyId=%s";
        em.persist(lastfmConnectorInfo);
        final String twitter = "Twitter";
        String[] twitterKeys = checkKeysExist(twitter, Arrays.asList("twitterConsumerKey", "twitterConsumerSecret"));
        ConnectorInfo twitterConnectorInfo = new ConnectorInfo(twitter,
                                     "/" + release + "/images/connectors/connector-twitter.jpg",
                                     res.getString("twitter"), "/twitter/token",
                                     Connector.getConnector("twitter"), order++, twitterKeys!=null,
                                     false, true, twitterKeys);
        twitterConnectorInfo.supportsRenewTokens = true;
        twitterConnectorInfo.renewTokensUrlTemplate = "twitter/token?apiKeyId=%s";
        em.persist(twitterConnectorInfo);
        final String fluxtreamCapture = "Fluxtream Capture";
        String[] fluxtreamCaptureKeys = checkKeysExist(fluxtreamCapture, new ArrayList<String>());
        em.persist(new ConnectorInfo(fluxtreamCapture,
                                     "/" + release + "/images/connectors/connector-fluxtream_capture.png",
                                     res.getString("fluxtream_capture"),
                                     "ajax:/fluxtream_capture/about",
                                     Connector.getConnector("fluxtream_capture"), order++, fluxtreamCaptureKeys!=null,
                                     false, true, fluxtreamCaptureKeys));
        String[] runkeeperKeys = checkKeysExist("Runkeeper", Arrays.asList("runkeeperConsumerKey", "runkeeperConsumerSecret"));
        final String runKeeper = "RunKeeper";
        final ConnectorInfo runkeeperConnectorInfo = new ConnectorInfo(runKeeper, "/" + release + "/images/connectors/connector-runkeeper.jpg", res.getString("runkeeper"), "/runkeeper/token", Connector.getConnector("runkeeper"), order++, runkeeperKeys != null, false, true, runkeeperKeys);
        runkeeperConnectorInfo.supportsRenewTokens = true;
        runkeeperConnectorInfo.renewTokensUrlTemplate = "runkeeper/token?apiKeyId=%s";
        em.persist(runkeeperConnectorInfo);
        String[] smsBackupKeys = checkKeysExist("SMS_Backup", Arrays.asList("google.client.id", "google.client.secret"));
        ConnectorInfo SMSBackupInfo = new ConnectorInfo("SMS_Backup",
                                                        "/" + release + "/images/connectors/connector-sms_backup.jpg",
                                                        res.getString("sms_backup"),
                                                        "/google/oauth2/token?scope=https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/gmail.readonly",
                                                        Connector.getConnector("sms_backup"), order++, true,
                                                        false,true,smsBackupKeys);
View Full Code Here

        // instance
        JSONArray connectorsArray = new JSONArray();
        boolean missingKeys=false;

        for (int i = 0; i < connectors.size(); i++) {
            final ConnectorInfo connectorInfo = connectors.get(i);
            final Connector api = connectorInfo.getApi();
            if (api == null) {
                StringBuilder sb = new StringBuilder("module=SystemServiceImpl component=connectorStore action=checkConnectorInstanceKeys ")
                        .append("message=\"null connector for " + connectorInfo.getName() + "\"");
                logger.warn(sb.toString());
                continue;
            }
            if(connectorInfo.enabled==false) {
                StringBuilder sb = new StringBuilder("module=SystemServiceImpl component=connectorStore action=checkConnectorInstanceKeys ")
                        .append("message=\"skipping connector instance keys check for disabled connector" + connectorInfo.getName() + "\"");
                logger.info(sb.toString());
                continue;
            }
            String[] apiKeyAttributeKeys = connectorInfo.getApiKeyAttributesKeys();
            if(apiKeyAttributeKeys==null) {
                StringBuilder sb = new StringBuilder("module=SystemServiceImpl component=connectorStore action=checkConnectorInstanceKeys ")
                        .append("message=\"skipping connector instance keys check for connector" + connectorInfo.getName() + "; does not use keys\"");
                logger.info(sb.toString());
                continue;
            }
            // This connector type is enabled, find all the instance keys for this connector type
            List<ApiKey> apiKeys = JPAUtils.find(em, ApiKey.class, "apiKeys.all.byApi", api.value());
            for(ApiKey apiKey: apiKeys) {
                StringBuilder sb = new StringBuilder("module=SystemServiceImpl component=connectorStore action=checkConnectorInstanceKeys apiKeyId=" + apiKey.getId())
                                .append(" message=\"checking connector instance keys for connector" + connectorInfo.getName() + "\"");

                logger.info(sb.toString());

                // Iterate over the apiKeyAttributeKeys to check if each is present
                for(String apiKeyAttributeKey: apiKeyAttributeKeys) {
View Full Code Here

TOP

Related Classes of org.fluxtream.core.domain.ConnectorInfo

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.