Package org.fluxtream.core.connectors

Examples of org.fluxtream.core.connectors.Connector


        return welcomeBack(connectorName, message);
    }

  @RequestMapping(value = "/app/from/{connectorName}")
  public String home(@PathVariable("connectorName") String connectorName) {
        final Connector connector = Connector.getConnector(connectorName);
        String message = "<img class=\"loading-animation\" src=\"/static/img/loading.gif\"/>You have successfully added a new connector: "
                         + connector.prettyName()
                         + ". Your data is now being retrieved. "
                         + "It may take a little while until it becomes visible.";
        return welcomeBack(connectorName, message);
  }
View Full Code Here


        return welcomeBack(connectorName, message);
  }

    public String welcomeBack(String connectorName, String message) {
        long guestId = AuthHelper.getGuestId();
        final Connector connector = Connector.getConnector(connectorName);
        notificationsService.addNamedNotification(guestId, Type.INFO, connector.statusNotificationName(), message);
        ApiKey apiKey = guestService.getApiKey(guestId, connector);
        connectorUpdateService.updateConnector(apiKey, true);
        return "redirect:/app";
    }
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

        String sessionKey = LastfmHelper.getSessionKey(jsonResponse);
    String username = LastfmHelper.getUsername(jsonResponse);
    Guest guest = AuthHelper.getGuest();

        final Connector connector = Connector.getConnector("lastfm");
        ApiKey apiKey;
        if (request.getSession().getAttribute(LASTFM_RENEWTOKEN_APIKEYID)!=null) {
            final String apiKeyIdString = (String) request.getSession().getAttribute(LASTFM_RENEWTOKEN_APIKEYID);
            long apiKeyId = Long.valueOf(apiKeyIdString);
            apiKey = guestService.getApiKey(apiKeyId);
        } else
            apiKey = guestService.createApiKey(guest.getId(), connector);

        guestService.populateApiKey(apiKey.getId());
    guestService.setApiKeyAttribute(apiKey, "sessionKey", sessionKey);
    guestService.setApiKeyAttribute(apiKey,  "username", username);

        if (request.getSession().getAttribute(LASTFM_RENEWTOKEN_APIKEYID)!=null) {
            request.getSession().removeAttribute(LASTFM_RENEWTOKEN_APIKEYID);
            return "redirect:/app/tokenRenewed/"+connector.getName();
        }
    return "redirect:/app/from/"+connector.getName();
  }
View Full Code Here

    String nsid = user.attributeValue("nsid");
    String fullname = user.attributeValue("fullname");
    String token = document.selectSingleNode("rsp/auth/token/text()").getStringValue();
   
    Connector flickrConnector = Connector.getConnector("flickr");

        ApiKey apiKey;
        if (request.getSession().getAttribute(FLICKR_RENEWTOKEN_APIKEYID)!=null) {
            final String apiKeyIdString = (String)request.getSession().getAttribute(FLICKR_RENEWTOKEN_APIKEYID);
            long apiKeyId = Long.valueOf(apiKeyIdString);
            apiKey = guestService.getApiKey(apiKeyId);
        } else
            apiKey = guestService.createApiKey(guest.getId(), flickrConnector);

        guestService.populateApiKey(apiKey.getId());
    guestService.setApiKeyAttribute(apiKey,  "username", username);
    guestService.setApiKeyAttribute(apiKey,  "token", token);
    guestService.setApiKeyAttribute(apiKey,  "nsid", nsid);
    guestService.setApiKeyAttribute(apiKey,  "fullname", fullname);

        if (request.getSession().getAttribute(FLICKR_RENEWTOKEN_APIKEYID)!=null) {
            request.getSession().removeAttribute(FLICKR_RENEWTOKEN_APIKEYID);
            return "redirect:/app/tokenRenewed/flickr";
        }
    return "redirect:/app/from/"+flickrConnector.getName();
  }
View Full Code Here

public class LastFmBodytrackResponder extends AbstractBodytrackResponder {
    @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();
        final ObjectType recent_track = ObjectType.getObjectType(connector, "recent_track");

        String objectTypeName = apiKey.getConnector().getName() + "-" + recent_track.getName();
        List<AbstractFacet> facets = getFacetsInTimespanOrderedByEnd(timeInterval,apiKey, recent_track);
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 recent_track = ObjectType.getObjectType(connector, "recent_track");
View Full Code Here


    @RequestMapping(value = "/addConnector", method = RequestMethod.POST)
    public void addUploadConnector(@RequestParam("connectorName") String connectorName,
                                   HttpServletResponse response) throws IOException {
        final Connector connector = Connector.getConnector(connectorName);
        final Guest guest = AuthHelper.getGuest();

        guestService.createApiKey(guest.getId(), connector);

        notificationsService.addNotification(guest.getId(), Notification.Type.INFO, "You just added an upload-only connector for " + connector.prettyName() + "<br>" +
                                                                              "Please head to <a href=\"javascript:App.manageConnectors()\">Manage Connectors</a>, " +
                                                                              "identify your new connector, and upload your data from there.");

        response.getWriter().write("Successfully added upload-only connector \"" + connectorName + "\"");
    }
View Full Code Here

            throw new RuntimeException("Attempt to upload file associated to another user's " +
                                       "ApiKey! apiKeyId=" + apiKeyId +
                                       ", guestId="  + AuthHelper.getGuestId());


        final Connector connector = apiKey.getConnector();
        executor.execute( new Runnable() {

            @Override
            public void run() {
                final AbstractUpdater bean = beanFactory.getBean(connector.getUpdaterClass());
                FileUploadSupport handler = (FileUploadSupport) bean;
                try {
                    handler.importFile(apiKey, f);
                }
                catch (Exception e) {
                    e.printStackTrace();
                    notificationsService.addExceptionNotification(guestId, Notification.Type.ERROR, "There was a problem importing your " + connector.prettyName() + " data.<br>" +
                                                                                                    "Please check the type and format of your file.", ExceptionUtils.getStackTrace(e));
                }
            }
        });
        notificationsService.addNotification(guestId, Notification.Type.INFO,
                                             "We are busy importing your " + connector.prettyName() + " data.<br>" +
                                             "You should be able to see it shortly.");

        response.getWriter().write("\"File was successfully uploaded: \" + originalFilename");

    }
View Full Code Here

      request.setAttribute("required", required);
      return new ModelAndView("connectors/openpath/enterCredentials");
    }
    long guestId = AuthHelper.getGuestId();

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

        guestService.setApiKeyAttribute(apiKey, "accessKey", accessKey);
        guestService.setApiKeyAttribute(apiKey, "secretKey", secretKey);
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.