在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):box/box-java-sdk开源软件地址(OpenSource Url):https://github.com/box/box-java-sdk开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):Box Java SDKThe Box Java SDK for interacting with the Box Content API. Latest ReleaseLatest release can be found here. VersionsWe use a modified version of Semantic Versioning for all changes. See version strategy for details which is effective from 30 July 2022. Supported VersionOnly the current MAJOR version of SDK is supported. New features, functionality, bug fixes, and security updates will only be added to the current MAJOR version. A current release is on the leading edge of our SDK development, and is intended for customers who are in active development and want the latest and greatest features. Instead of stating a release date for a new feature, we set a fixed minor or patch release cadence of maximum 2-3 months (while we may release more often). At the same time, there is no schedule for major or breaking release. Instead, we will communicate one quarter in advance the upcoming breaking change to allow customers to plan for the upgrade. We always recommend that all users run the latest available minor release for whatever major version is in use. We highly recommend upgrading to the latest SDK major release at the earliest convenient time and before the EOL date. Version schedule
Getting StartedGetting Started Docs: https://developer.box.com/guides/tooling/sdks/java/ API Reference: https://developer.box.com/reference/ QuickstartThe SDK can be obtained by adding it as a maven dependency, cloning the source into your project, or by downloading one of the precompiled JARs from the releases page on GitHub. IF YOU USE THE JAR, you'll also need to include several dependencies:
An app has to be authorized by the admin of the enterprise before these tests. It's always good to begin with the Getting Started Section at Box's developer website Quick TestFollowing things work only if the app has been configured and authorized as mentioned here Here is a simple example of how to authenticate with the API using a developer token and then print the ID and name of each item in your root folder. BoxAPIConnection api = new BoxAPIConnection("developer-token");
BoxFolder rootFolder = BoxFolder.getRootFolder(api);
for (BoxItem.Info itemInfo : rootFolder) {
System.out.format("[%s] %s\n", itemInfo.getID(), itemInfo.getName());
} For more details on how to get started, check out the overview guide. It has a short explanation of how the SDK works and how you can get started using it. Sample ProjectsThree sample projects can be found in MainThis project will output your name and a list of the files and folders in your root directory. To run the project, first provide a developer token in
public final class Main {
private static final String DEVELOPER_TOKEN = "<YOUR_DEVELOPER_TOKEN>";
// ...
} Then just invoke Other projectsBelow projects need app configurations stored in JSON format in This configuration file can be downloaded from your application's CreateAppUserThis project will output the user id of enterprise admin and will create a new App User for the enterprise. To run the project, first provide the name of the app user in public final class CreateAppUser {
private static final String APP_USER_NAME = "";
private static final String EXTERNAL_APP_USER_ID = "";
// ...
} Then just invoke Note: The JCE bundled with oracle JRE supports keys upto 128 bit length only. To use larger cryptographic keys, install JCE Unlimited Strength Jurisdiction Policy Files. AccessAsAppUserThis project will retrieve the information of the given App User and will list the files/folders under root folder. To run the project, first provide the Id of the app user in public final class AccessAsAppUser {
private static final String USER_ID = "";
// ...
} Then just invoke Note: The JCE bundled with oracle JRE supports keys upto 128 bit length only. To use larger cryptographic keys, install JCE Unlimited Strength Jurisdiction Policy Files. BoxDeveloperEditionAPIConnectionAsEnterpriseUserThis example shows how to get tokens for an enterprise user, say admin of the enterprise and do actions on behalf of admin. To run the project, follow below steps
public final class BoxDeveloperEditionAPIConnectionAsEnterpriseUser {
private static final String USER_ID = "";
// ...
Reader reader = new FileReader("src/example/config/config.json");
BoxConfig boxConfig = BoxConfig.readFrom(reader);
BoxDeveloperEditionAPIConnection api =
new BoxDeveloperEditionAPIConnection(USER_ID, DeveloperEditionEntityType.USER, boxConfig, accessTokenCache);
} CompatibilityThe Box Java SDK is compatible with Java 8 and up. BuildingThe SDK uses Gradle for its build system. SDK comes with Gradle wrapper. Running $ ./gradlew build The SDK also includes integration tests which make real API calls, and therefore
are run separately from unit tests. Integration tests should be run against a
test account since they create and delete data. To run the integration tests,
remove the $ ./gradlew integrationTest DocumentationYou can find guides and tutorials in the
Javadocs are generated when Vulnerabilities in Bouncycastle librariesIn Box Java SDK we are using:
There are some moderate vulnerabilities reported against those versions:
We cannot upgrade those libraries as they are working with FIPS 140-2 certified cryptographic module. Some of our customers require certified cryptography module and our SDK must work with it. If you want to use modern Gradle example implementation('com.box:box-java-sdk:x.y.z') {
exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on'
exclude group: 'org.bouncycastle', module: 'bcpkix-jdk15on'
}
runtimeOnly('org.bouncycastle:bcprov-jdk15on:1.70')
runtimeOnly('org.bouncycastle:bcpkix-jdk15on:1.70') Maven example: <dependencies>
<dependency>
<groupId>com.box</groupId>
<artifactId>box-java-sdk</artifactId>
<version>x.y.z</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.70</version>
<scope>runtime</scope>
</dependency>
</dependencies> Copyright and LicenseCopyright 2019 Box, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论