Package com.box.boxjavalibv2.filetransfer

Examples of com.box.boxjavalibv2.filetransfer.IFileTransferListener


                final IBoxOAuthManager oAuthManager = boxClient.getOAuthManager();
                final BoxOAuthToken oAuthToken = oAuthManager.createOAuth(authorizationCode,
                    configuration.getClientId(), configuration.getClientSecret(), null);

                // send initial token to BoxClient and this.listener
                final OAuthDataMessage authDataMessage = new OAuthDataMessage(oAuthToken,
                    boxClient.getJSONParser(), boxClient.getResourceHub());
                listener.onAuthFlowEvent(OAuthEvent.OAUTH_CREATED, authDataMessage);
                this.listener.onAuthFlowEvent(OAuthEvent.OAUTH_CREATED, authDataMessage);
            }
View Full Code Here


                final IBoxOAuthManager oAuthManager = boxClient.getOAuthManager();
                final BoxOAuthToken oAuthToken = oAuthManager.createOAuth(authorizationCode,
                    configuration.getClientId(), configuration.getClientSecret(), null);

                // send initial token to BoxClient and this.listener
                final OAuthDataMessage authDataMessage = new OAuthDataMessage(oAuthToken,
                    boxClient.getJSONParser(), boxClient.getResourceHub());
                listener.onAuthFlowEvent(OAuthEvent.OAUTH_CREATED, authDataMessage);
                this.listener.onAuthFlowEvent(OAuthEvent.OAUTH_CREATED, authDataMessage);
            }
View Full Code Here

                    values.put(BoxOAuthToken.FIELD_REFRESH_TOKEN, refreshToken);
                    return new BoxOAuthToken(values);
                }
            }
        });
        configuration.setRefreshListener(new OAuthRefreshListener() {
            @Override
            public void onRefresh(IAuthData newAuthData) {
                log.debug("Refreshed OAuth data: " + ((newAuthData != null) ? newAuthData.getAccessToken() : null));
            }
        });
View Full Code Here

        // authorize application on user's behalf
        try {
            final String csrfId = String.valueOf(new SecureRandom().nextLong());

            OAuthWebViewData viewData = new OAuthWebViewData(boxClient.getOAuthDataController());
            viewData.setOptionalState(String.valueOf(csrfId));
            final HtmlPage authPage = webClient.getPage(viewData.buildUrl().toString());

            // submit login credentials
            final HtmlForm loginForm = authPage.getFormByName("login_form");
            final HtmlTextInput login = loginForm.getInputByName("login");
            login.setText(configuration.getUserName());
View Full Code Here

        // authorize application on user's behalf
        try {
            final String csrfId = String.valueOf(new SecureRandom().nextLong());

            OAuthWebViewData viewData = new OAuthWebViewData(boxClient.getOAuthDataController());
            viewData.setOptionalState(String.valueOf(csrfId));
            final HtmlPage authPage = webClient.getPage(viewData.buildUrl().toString());

            // submit login credentials
            final HtmlForm loginForm = authPage.getFormByName("login_form");
            final HtmlTextInput login = loginForm.getInputByName("login");
            login.setText(configuration.getUserName());
View Full Code Here

        // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxCollabRequestObject
        final BoxCollabRequestObject collabObject = BoxCollabRequestObject.createCollabObject(testFolderId, null,
                "camel.test@localhost.com", BoxCollaborationRole.VIEWER);
        headers.put("CamelBox.collabRequest", collabObject);

        BoxCollaboration result = requestBodyAndHeaders("direct://CREATECOLLABORATION",
                null, headers);
        assertNotNull("createCollaboration result", result);
        // wait a moment for collaboration to register
        Thread.sleep(2000);
        return result;
View Full Code Here

        LOG.debug("getAllCollaborations: " + result);
    }

    @Test
    public void testGetCollaboration() throws Exception {
        final BoxCollaboration collaboration = createCollaboration();

        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.collabId", collaboration.getId());
            // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject
            headers.put("CamelBox.defaultRequest", null);

            BoxCollaboration result = requestBodyAndHeaders("direct://GETCOLLABORATION", null, headers);
            assertNotNull("getCollaboration result", result);
            LOG.debug("getCollaboration: " + result);
        } finally {
            deleteCollaboration(collaboration.getId());
        }
View Full Code Here

    }

    @Ignore("BoxClient SDK has a bug in UpdateCollaborationRequest.java, the URI constant should be collaborations")
    @Test
    public void testUpdateCollaboration() throws Exception {
        final BoxCollaboration collaboration = createCollaboration();

        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.collabId", collaboration.getId());
            // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxCollabRequestObject
            final BoxCollabRequestObject requestObject = BoxCollabRequestObject.updateCollabObjects(
                    BoxCollaborationRole.EDITOR);
            headers.put("CamelBox.collabRequest", requestObject);

            BoxCollaboration result = requestBodyAndHeaders("direct://UPDATECOLLABORATION", null, headers);
            assertNotNull("updateCollaboration result", result);
            LOG.debug("updateCollaboration: " + result);
        } finally {
            deleteCollaboration(collaboration.getId());
        }
View Full Code Here

    private static final String PATH_PREFIX = BoxApiCollection.getCollection().getApiName(IBoxEventsManagerApiMethod.class).getName();

    @Test
    public void testGetEventOptions() throws Exception {
        // using com.box.restclientv2.requestsbase.BoxDefaultRequestObject message body for single parameter "defaultRequest"
        BoxCollection result = requestBody("direct://GETEVENTOPTIONS", null);

        assertNotNull("getEventOptions result", result);
        LOG.debug("getEventOptions: " + result);
    }
View Full Code Here

        // parameter type is String
        headers.put("CamelBox.folderId", "0");
        // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxPagingRequestObject
        headers.put("CamelBox.pagingRequest", BOX_PAGING_REQUEST_OBJECT);

        BoxCollection result = requestBodyAndHeaders("direct://GETFOLDERITEMS", null, headers);
        assertNotNull(result);
        LOG.debug("getFolderItems: " + result);
    }
View Full Code Here

TOP

Related Classes of com.box.boxjavalibv2.filetransfer.IFileTransferListener

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.