Cloud: Java Cloud Service SDK

#

## Sample Introduction

This sample is a Maven project that shows you how to access the local file system and the Storage Cloud Service file system mapping.

For details about the sample code, see the files that are listed in the following table.

## Main Files Used in the Sample

Directory Location:

SDK_HOME/samples/maven/filebrowser

(where SDK_HOME is the directory containing your Java Cloud Service installation)

File Click source files to view code. | Description
--- | ---
pom.xml | Project Object Model file that contains information about the project and configuration details used by Maven to build the project.
FileDesc.java | Provides file entity that will be used in the web service.
AppResource.java | Provides root resource for the RESTful web service.
index.jsp | Welcome page
LocalFileSystem.html | Describes how to access local file system.
web.xml | Web application deployment descriptor.
weblogic.xml | Oracle WebLogic Server-specific Web application deployment descriptor that declares the application context root.

## Prepare the Sample

### Prerequisites for Installing the Maven Plug-in

Each Maven goal supports all of its corresponding CLI command arguments as properties. To install the Maven plug-in (maven-javacloud.jar), follow these steps:

1. Unzip the SDK and set an environment variable `SDK_HOME` that points to the unzipped directory.
   For example: `export SDK_HOME=/home/user/oracle-javacloud-sdk`
2. `mvn install:install-file -Dfile=$SDK_HOME/lib/maven-javacloud.jar -DpomFile=$SDK_HOME/doc/resources/javacloud.pom`

You can also refer to Java Cloud Service SDK Tools Documentation: Maven Plugin for more details.

## Build and Install the Sample from the SDK

To build and install the sample, follow these steps:

1. Change to the `SDK_HOME/samples/maven/filebrowser` directory,
   where SDK_HOME refers to the main Java Cloud Service SDK installation directory, such as `/home/user/oracle-javacloud-sdk`.
2. Update the following `pom.xml` properties with the correct values. You can also pass these properties on the command line. For example: `-Duser=myusername`
   - `<local>false</local>` Set local to true is you want to install the sample in local environment
   - `<adminurl>adminurl</adminurl>` Note: adminurl must be specified when `local=true`. When `local=false`, either datacenter(default value is us1) or adminurl has to be specified.
   - `<user>user</user>`
   - `<identitydomain>id</identitydomain>`
   - `<serviceinstance>si</serviceinstance>`
3. `mvn install -DSDK_HOME=$SDK_HOME -Dpassword=pwd`

Use `-Dlocal=true` and `-Dclasspath=<path to weblogic.jar>` when you are deploying to local Weblogic domain.

You can also refer to Java Cloud Service SDK Tools Documentation: Maven Plugin for more details.

## Run the Sample

1. Complete the steps in the "Prepare the Sample" section and "Build and Install the Sample from the SDK" section.
2. Launch your web browser with the URL pattern `http://server:port/filebrowser`, where the server would include the identity domain and service instance name. For example, `https://java1-wnctrial.java.dc1.c9labga.us.oracle.com/filebrowser`, where `java1` is the service instance name and `wnctrial` is the identity domain. The rest of the host name `java.dc1.c9labga.us.oracle.com` is based on the environment.