Package com.force.sdk.connector

Examples of com.force.sdk.connector.ForceServiceConnector


        // Repository name
        RepositoryId repoId = RepositoryId.create(repoOwner, repoName);
        map.put("repositoryName", repoId.generateId());
       
        // Display user info
        ForceServiceConnector forceConnector = new ForceServiceConnector(ForceServiceConnector.getThreadLocalConnectorConfig());
        map.put("userContext", forceConnector.getConnection().getUserInfo());
               
        // Display repo info
        GitHubClientOAuthServer client =
          new GitHubClientOAuthServer(System.getenv(GITHUB_CLIENT_ID), System.getenv(GITHUB_CLIENT_SECRET) );
        map.put("repo", null);
        map.put("githubcontents", null);
        RepositoryService service = new RepositoryService(client);
        map.put("repo", service.getRepository(repoId));
       
        // Prepare Salesforce metadata metadata for repository scan
        RepositoryScanResult repositoryScanResult = new RepositoryScanResult();
        RepositoryItem repositoryContainer = new RepositoryItem();
        repositoryContainer.repositoryItems = new ArrayList<RepositoryItem>();
        repositoryScanResult.metadataFolderBySuffix = new HashMap<String, DescribeMetadataObject>();
        DescribeMetadataResult metadataDescribeResult = forceConnector.getMetadataConnection().describeMetadata(29.0); // TODO: Make version configurable / auto
        for(DescribeMetadataObject describeObject : metadataDescribeResult.getMetadataObjects())
        {
          repositoryScanResult.metadataFolderBySuffix.put(describeObject.getSuffix(), describeObject);
          if(describeObject.getMetaFile())
            repositoryScanResult.metadataFolderBySuffix.put(describeObject.getSuffix() + "-meta.xml", describeObject);
View Full Code Here


      }
    }    
    zipOS.close();
       
    // Connect to Salesforce Metadata API
        ForceServiceConnector connector = new ForceServiceConnector(ForceServiceConnector.getThreadLocalConnectorConfig());
        MetadataConnection metadataConnection = connector.getMetadataConnection();
       
    // Deploy to Salesforce
    DeployOptions deployOptions = new DeployOptions();
    deployOptions.setSinglePackage(true);
    deployOptions.setPerformRetrieve(false);
View Full Code Here

    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/{owner}/{repo}/checkstatus/{asyncId}")
    public String checkStatus(@PathVariable("asyncId") String asyncId) throws Exception
    {
      // Connect to Metadata API, check async status and return to client
        ForceServiceConnector connector = new ForceServiceConnector(ForceServiceConnector.getThreadLocalConnectorConfig());
        MetadataConnection metadataConnection = connector.getMetadataConnection();
        AsyncResult asyncResult =  metadataConnection.checkStatus(new String[] { asyncId })[0];
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.getSerializationConfig().addMixInAnnotations(AsyncResult.class, AsyncResultMixIn.class);     
    return objectMapper.writeValueAsString(asyncResult);
    }
View Full Code Here

    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/{owner}/{repo}/checkdeploy/{asyncId}")
    public String checkDeploy(@PathVariable("asyncId") String asyncId) throws Exception
    {
      // Connect to Metadata API, check async status and return to client
        ForceServiceConnector connector = new ForceServiceConnector(ForceServiceConnector.getThreadLocalConnectorConfig());
        MetadataConnection metadataConnection = connector.getMetadataConnection();
        DeployResult deployResult = metadataConnection.checkDeployStatus(asyncId);
    ObjectMapper objectMapper = new ObjectMapper();
    return objectMapper.writeValueAsString(printErrors(deployResult));
    }
View Full Code Here

        try {
            ForceJPAClassGenerator generator = new ForceJPAClassGenerator();
            generator.setPackageName("com.ftest.model");
            generator.setObjectFilter(new ObjectNameWithRefFilter(objectNames));
           
            ForceServiceConnector connector = new ForceServiceConnector(PropsUtil.FORCE_SDK_TEST_NAME);
           
            int classCount = generator.generateCode(connector.getConnection(), new File(TMP_DIR));
            int expectedCount = expectedFileNames.size();

            File[] actualFiles =
                new File(TMP_DIR + File.separator + "com" + File.separator + "ftest" + File.separator + "model")
                    .listFiles();
View Full Code Here

     */
    @Override
    public ManagedConnection createManagedConnection(Object poolKey, Map transactionOptions) {
        ForceStoreManager storeManager = (ForceStoreManager) omfContext.getStoreManager();
           
        ForceServiceConnector connector = new ForceServiceConnector();
       
        // A ConnectorConfig might have been set via OAuth in which case we should be
        // using that.
        ForceConnectorConfig tlConfig;
        if ((tlConfig = ForceServiceConnector.getThreadLocalConnectorConfig()) != null) {
            connector.setConnectorConfig(tlConfig);
        } else {
            connector.setConnectorConfig(storeManager.getConfig());
        }
       
        connector.setConnectionName(omfContext.getPersistenceConfiguration().getStringProperty("force.ConnectionName"));
        connector.setClientId(ForceServiceConnector.API_USER_AGENT);
        connector.setTimeout(omfContext.getPersistenceConfiguration().getIntProperty("datanucleus.datastoreReadTimeout"));
        connector.setSkipCache(omfContext.getPersistenceConfiguration()
                                            .getBooleanProperty("force.skipConfigCache", false /* resultIfNotSet */));
       
        return new ForceManagedConnection(connector);
    }
View Full Code Here

        UserInfo info = TestContext.get().getUserInfo();
        ForceConnectorConfig config = new ForceConnectorConfig();
        config.setAuthEndpoint(info.getServerEndpoint());
        config.setUsername(info.getUserName());
        config.setPassword(info.getPassword());
        ForceServiceConnector connector = new ForceServiceConnector(config);
        return connector.getNamespace();
    }
View Full Code Here

     * @throws ConnectionException ConnectionException
     * @throws IOException IOException
     */
    public static UserInfo loadFromPropertyFile(String propertyFileName) throws ConnectionException, IOException {
        // Load up the connection properties on the classpath
        ForceServiceConnector connector = new ForceServiceConnector(propertyFileName);
        PartnerConnection conn = connector.getConnection();
       
        assertNotNull(conn, "Unable to establish API connection. See " + propertyFileName + ".properties");
       
        // Get the user information from the API connection
        GetUserInfoResult userInfoResult = conn.getUserInfo();
View Full Code Here

        ForceConnectorConfig config = new ForceConnectorConfig();
        try {
            config.setServiceEndpoint(sc.getEndPoint());
            config.setSessionId(sc.getSessionId());
            config.setSessionRenewer(this);
            ForceServiceConnector connector = new ForceServiceConnector();
            connector.setConnectorConfig(config);
            //logout from the partner API
            connector.getConnection().logout();
        } catch (ConnectionException e) {
            LOGGER.warn("Error logging out through API: ", e.getMessage());
            LOGGER.debug("Error logging out through API: ", e);
        }
       
View Full Code Here

            TestContext.get().setTestProps(props);
        } finally {
            if (is != null) is.close();
        }
        // create test force connector
        connector = new ForceServiceConnector(PropsUtil.FORCE_SDK_TEST_NAME);
        totalNumSObjects = connector.getConnection().describeGlobal().getSobjects().length;
    }
View Full Code Here

TOP

Related Classes of com.force.sdk.connector.ForceServiceConnector

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.