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);