Cloud: Java Cloud Service SDK

#

## Introduction

The following sample applications are provided in the Java Cloud Service SDK. You can build the samples and deploy them to a Java Cloud Service instance.

- Database CRUD Operations: Visitors Aquarium
- Java EE 5:
  - Bookstore Servlet Programming
  - Java Pet Store Reference Application
- Java EE 6:
  - Developing a Simple JavaServer Faces Application Using Ajax Technology
  - Developing a Simple JavaServer Faces Application Using Facelets Technology
- Maven Plug-in Projects:
  - Using a File Browser to Access the Local File System
  - Deploying Message-driven Beans on Local JMS Destinations
  - Demonstrating JDK-based Logging
  - Testing Whether Java Code Runs on Oracle Cloud
- Security:
  - Servlet Using BASIC Authentication and Role Based Authorization
  - Servlet Using FORM Based Authentication and Role Based Authorization
  - Servlet Using SSO Authentication and Role Based Authorization
  - Single Sign-On Authentication
- Spring Application Support
- Web Application for Internationalizing and Localizing Dates
- Web Services Security (WSS) Username Token Protected Web Service

Note: For more information on the EE samples, see General Build Notes for Java EE Samples.

All sample root folders contain a build.xml file to build, install, and run the samples.

## Build the Sample Applications

Before building the sample applications, ensure that you first specify custom Oracle Cloud instance information in the `build.common.properties` file.

1. Install WebLogic Server 10.3.6 and configure it. This is required only if you want to deploy applications locally.
2. Set the following environment variables:
   - On Linux You can modify the `myenv.sh` file for this and then run it: `. ./myenv.sh`
   - On Windows, modify the sample file `myenv.cmd` and then run it: `myenv.cmd`
   If you set the environment using the `myenv.*` file, then skip to Step 4.
3. If you want to set the paths/classpath manually, follow these additional steps:

1. If you are going to install your application only on the remote Oracle Cloud, you will not need to have WebLogic Server installed locally. Just make sure that "ant" and "javac" are available in the path. If you have WebLogic Server installed, you can use Ant from there, as described in step 2b.
2. If Ant is not available in the path and you have WebLogic Server installed, add the following path for Ant: `\modules\org.apache.ant_1.7.1\bin`
   For example, on Windows: `set path=%MW_HOME%\modules\org.apache.ant_1.7.1\bin;%path%`
3. Add `weblogic.jar` in the path if you are going to deploy the application on your local WebLogic Server.
   For example, on Windows: `classpath=%classpath%;%MW_HOME%\wlserver\server\lib\weblogic.jar`

4. Modify the `oracle-javacloud-sdk\samples\build.common.properties` as explained in the property file. These parameters are used to customize the application to run in your environment.
   If deploying applications to local WebLogic domain then set the admin-url to `http://:` (for example, `http://localhost:7001`).
5. To build all the samples and install them, go to the `oracle-javacloud-sdk\samples` folder, and run "ant". This will build all the applications from scratch and deploy all to the local WebLogic domain or the Oracle Cloud, as specified in the `build.common.properties` file.
6. To build a single sample, go to the root folder of an individual sample applications (you can refer to the sample-specific instruction.html or readme.txt files), and run "ant" to do a clean build and deploy the application.
7. To use the applications, open a web browser and enter the URL as described in the instruction.html or readme.txt file, or in the build.xml file's `run.uri` property.

## Porting Sample Applications

If installed sample applications containing service-specific information, such as roles or the DB instance name, are moved to a different Java Cloud Service instance, then you must rebuild each imported sample application, either separately or in a batch, as described in Build the Sample Applications.

These sample applications are not portable because they use roles or a database, and so need to be rebuilt when moved to a different Java Cloud Service instance:

- BASIC Authentication and Role Based Authorization
- FORM Based Authentication and Role Based Authorization
- SSO Authentication and Role Based Authorization
- Single Sign-On Authentication
- Database Operations: Visitors Aquarium
- Java EE 5: Servlet Programming (Bookstore)
- Java Pet Store Reference Application