oracle.cle.resource
Class DeploymentManager

java.lang.Object
  |
  +--oracle.cle.resource.DeploymentManager

public class DeploymentManager
extends java.lang.Object

A Singleton that handles the logistics mappings for Resources (or anything for that matter). This loads a properties file (deployment.properties) that relates a Resource name (business object name) to a deployment key (Connection name). The deployment key typically tells a ConnectionManager's ConnectionProvider how to make a connection for the given Resource (business object). For example, a Customer could be associated with a JDBC Connection with a deployment key of customer while a Catalog might be associated with an EJBHome with a deployment key of catalog. Both customer and catalog would have connection information specific to there deployment scenarios and, would, therefore, be connected through a dedicated ConnectionProvider.

See ConnectionManager for more details on deployment keys.

Typical structure of a deployment.properties file:

 
 # use a default in case a deployment is not specified for a resource
 default=bc4j_personnel
 # resource names must be fully qualified!
 oracle.demo.security.resource.ApplicationUser=bc4j_security
 oracle.demo.security.resource.Person=bc4j_security
 oracle.demo.personnel.resource.Employee=bc4j_personnel
 oracle.demo.personnel.resource.Department=bc4j_personnel
 
 

NOTE: If deploying in JServer, you must put your properties file in the same package as the class that is loading them. this applies to jar files, as well. If not in JServer, you can put the properties file in the class' package OR in the top level of your classpath.


Field Summary
static java.lang.String DEFAULT_DEPLOYMENT_KEY
          The name of the key to use if a resource does not have a specific deployment entry
static java.lang.String FILENAME
          The name of the properties file that this class looks up
 
Constructor Summary
protected DeploymentManager()
          Make sure only this class and it's children can construct an instance NOTE: The constructor is private
 
Method Summary
 java.lang.String getDeploymentKey(java.lang.Class aClass)
           
 java.lang.String getDeploymentKey(java.lang.Object anObject)
           
 java.lang.String getDeploymentKey(java.lang.String resourceKey)
           
static DeploymentManager getInstance()
          The one public access point for the instance.
 void load()
          (Re)read the deployment properties from the file
static void main(java.lang.String[] args)
          Test routine
 void setDefaultDeploymentKey(java.lang.String aDefaultDeploymentKey)
          Set the defaultDeploymentKey for all resources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILENAME

public static final java.lang.String FILENAME
The name of the properties file that this class looks up

DEFAULT_DEPLOYMENT_KEY

public static final java.lang.String DEFAULT_DEPLOYMENT_KEY
The name of the key to use if a resource does not have a specific deployment entry
Constructor Detail

DeploymentManager

protected DeploymentManager()
Make sure only this class and it's children can construct an instance NOTE: The constructor is private
Method Detail

getInstance

public static DeploymentManager getInstance()
The one public access point for the instance. Most everything can done through public static methods that access the instancevariable, though.

load

public void load()
(Re)read the deployment properties from the file

setDefaultDeploymentKey

public void setDefaultDeploymentKey(java.lang.String aDefaultDeploymentKey)
Set the defaultDeploymentKey for all resources

getDeploymentKey

public java.lang.String getDeploymentKey(java.lang.Object anObject)
                                  throws java.lang.Exception

getDeploymentKey

public java.lang.String getDeploymentKey(java.lang.Class aClass)
                                  throws java.lang.Exception

getDeploymentKey

public java.lang.String getDeploymentKey(java.lang.String resourceKey)
                                  throws java.lang.Exception

main

public static void main(java.lang.String[] args)
Test routine


Copyright © 2003 ORACLE Corp. All Rights Reserved.