| Sun Java System Application Server |
This sample application demonstrates:
The external JNDI resource factory used in this application is an LDAP-based object repository that enables you to store and retrieve objects on a designated LDAP server. This sample application also provides an application client component that illustrates how to access a resource factory.
Relative to install_dir/samples/jndi/apps/external/, the
directory structure of this sample application is:
external-client/src/conf - Contains the application client
deployment descriptors required for deployment on the application server
external-client/src/java/samples/jndi/custom/client - Contains
the source code for the application client
external-share/src/java/samples/jndi/custom/share - Contains
the source code for the ExternalBean. The application client
allows adding this kind of object into the external repository so that you
can extract it later for verification. This directory also contains the classes
that implement the external JNDI resource factory: the interface of the external
factory (ExternalRepository), its implementation (ExternalFactoryImpl),
and the factory object required to create such objects (ExternalFactoryImplFactory)
The general instructions for building, deploying, and running sample applications are provided in Building, Deploying, and Running Sample Applications. In reading this document, use the following application-specific variables for this application:
install_dir is the directory where Application Server
is installed.
app_dir is the application base directory: install_dir/samples/jndi/apps/external.
jndi-external.ear.
Follow this general procedure:
build.xml, is in the app_dir
directory, specifically, install_dir/samples/jndi/apps/external.
install_dir/samples/jndi/apps/external/jndi-external.ear.
This application requires access to an LDAP server. Before running the application client, you must create a property file that contains a property specifying the LDAP server. Place the property file in a local directory accessible to the application client or in a accessible location accesible via HTTP URL.
To create the property file, copy and
modify the file
To run the application, enter these commands:
This command invokes the application client for this
sample application. The application client requires two to four arguments:
The run target of the main
For example, to create the external repository in the remote LDAP server,
use the following command:
Copyright © 2006 Sun Microsystems, Inc.
All rights reserved. app_dir/src/conf/ExternalRepository.properties.
The file contains three properties. Set the java.naming.provider.url>/code> property
to indicate where your LDAP server is running. You may change the
external.repository.name property to change the name of the
external repository.
Running the Sample Application
cd install_dir/samples/jndi/apps/external
asant run
build.xml file has four
properties that you can set.
asant
-Dproperty.file.location="URL_or_pathname_of_property_file"
-Dcommand.name="CREATE" run
To store an object in the external repository, use the following command:
asant
-Dproperty.file.location="URL_or_pathname_of_property_file"
-Dcommand.name="STORE"
-Dcommand.arg1="object_jndi_name"
-Dcommand.arg2="object_type" run
To look up an object in the external repository, use the following command:
asant -Dproperty.file.location="URL_or_pathname_of_property_file"
-Dcommand.name="LOOKUP"
-Dcommand.arg1="object_jndi_name" run