BEA Systems, Inc.

BEA WebLogic Server 9.0 API Reference


weblogic.deploy.api.tools
Class SessionHelper

java.lang.Object
  extended byweblogic.deploy.api.tools.SessionHelper

public final class SessionHelper
extends Object

Convenience methods for deployment tools based on the javax.enterprise.deploy package.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved.

Method Summary
 void close()
          Closes resources associated with the current DeployableObject and DeploymentConfiguration.
 File getApplication()
          The application archive.
 File getApplicationRoot()
          Root directory potentially containing "app" and "plan" subdirectories as default locations for application files and deployment plan information.
 WebLogicDeploymentConfiguration getConfiguration()
          The current configuration.
 TargetModuleID[] getDefaultJMSTargetModuleIDs(weblogic.management.configuration.DomainMBean domain, weblogic.management.configuration.TargetMBean[] deploymentTargets, String appName, String name)
          Creates TargetModuleID objects for a JMS module contained withing this application.
 WebLogicDeployableObject getDeployableObject()
          The root deployable object.
static WebLogicDeploymentManager getDeploymentManager(String host, String port)
          Allocate a connected DeploymentManager.
static WebLogicDeploymentManager getDeploymentManager(String host, String port, String userName, String password)
          Allocate a connected DeploymentManager.
static WebLogicDeploymentManager getDeploymentManager(String protocol, String host, String port, String userName, String password)
          Allocate a connected DeploymentManager.
 String[] getDescriptorUris(ModuleType type)
          Returns module URIs in the application based on module type.
static WebLogicDeploymentManager getDisconnectedDeploymentManager()
          Allocate a disconnected DeploymentManager.
static SessionHelper getInstance(WebLogicDeploymentManager dm)
          get a SessionHelper for a DeploymentManager
 weblogic.j2ee.descriptor.wl.JMSBean getJMSDescriptor(String name)
           
 ModuleInfo getModuleInfo()
          Collects module information based on an application's structure configuration.
 File getPlan()
          The deployment plan.
static WebLogicDeploymentManager getRemoteDeploymentManager(String host, String port, String userName, String password)
          Allocate a connected DeploymentManager.
static WebLogicDeploymentManager getRemoteDeploymentManager(String protocol, String host, String port, String userName, String password)
          Allocate a connected DeploymentManager.
 Target getTarget(weblogic.management.configuration.TargetMBean target)
          Given a TargetMBean, returns a jsr88 Target object
 void initializeConfiguration()
          Populates the configuration based on current values of this object's properties.
 void inspect()
          Creates DeployableObject's for the application without parsing most deployment descriptors.
 boolean isFullInit()
          Indicates whether initializeConfiguration() should perform a full initialization of the session.
 boolean isUpdatePlanVersion()
          Indicates whether the plan version should be updated automatically prior to saving a new plan.
 void saveApplicationRoot()
          Saves all application artifacts, using a new app root structure.
 void savePlan()
          Saves new copy of deployment plan along with any external documents in the plan directory.
 void setApplication(File application)
          Establishes location of the application.
 void setApplicationRoot(File root)
          Establishes installation root for the application and plan information.
 void setDebug()
          Turn on debugging.
 void setFullInit(boolean fullInit)
          Specifies the amount of work involved in initializeConfiguration().
 void setPlan(File plan)
          Establishes location of the deployment plan.
 void setUpdatePlanVersion(boolean updatePlanVersion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public void close()
Closes resources associated with the current DeployableObject and DeploymentConfiguration. Any further reference to these will have indeterminate results. It is recommended this method be invoked when done with configuration, otherwise the application archives will remain in an opened state.

The DeploymentManager is left alone. To release its resources WebLogicDeploymentManager.release() should be invoked.


getApplication

public File getApplication()
The application archive. May be an archived file or directory.

Returns:
location of application archive

getApplicationRoot

public File getApplicationRoot()
Root directory potentially containing "app" and "plan" subdirectories as default locations for application files and deployment plan information.

Returns:
installation root directory for the application artifacts

getConfiguration

public WebLogicDeploymentConfiguration getConfiguration()
The current configuration. initializeConfiguration must be invoked prior to this method.


getDefaultJMSTargetModuleIDs

public TargetModuleID[] getDefaultJMSTargetModuleIDs(weblogic.management.configuration.DomainMBean domain,
                                                     weblogic.management.configuration.TargetMBean[] deploymentTargets,
                                                     String appName,
                                                     String name)
                                              throws ConfigurationException
Creates TargetModuleID objects for a JMS module contained withing this application. The objects returned provide for default JMS submodule targetting only. When deploying the application, these object can be included with the application level TargetModuleID objects. The session must have been initialized prior to using this method.

Parameters:
domain - is the DomainMBean providing access to the domian configuration
deploymentTargets - is a list of targets where the application is to be deployed
appName - is the name the application will be deployed under
name - is the name of the JMS module, eg my-jms.xml. For a standalone JMS module this is the module's filename. For an embedded JMS module, the name must match the name assigned to the module in the weblogic-application.xml descriptor.
Returns:
JMS module targetting objects, or null if not relevant. This would be the case if the application already has targetting setup for the JMS submodules, or if there is no JMS module with the provided name in the application.
Throws:
ConfigurationException

getDeployableObject

public WebLogicDeployableObject getDeployableObject()
The root deployable object. initializeConfiguration must be invoked prior to this method.


getDeploymentManager

public static WebLogicDeploymentManager getDeploymentManager(String host,
                                                             String port)
                                                      throws DeploymentManagerCreationException
Allocate a connected DeploymentManager. The session will be able to request deployment operations. The session is assumed to already have set up a context with the admin server.

Throws:
DeploymentManagerCreationException

getDeploymentManager

public static WebLogicDeploymentManager getDeploymentManager(String host,
                                                             String port,
                                                             String userName,
                                                             String password)
                                                      throws DeploymentManagerCreationException
Allocate a connected DeploymentManager. The session will be able to request deployment operations. The session is assumed to be local to the admin server.

Throws:
DeploymentManagerCreationException

getDeploymentManager

public static WebLogicDeploymentManager getDeploymentManager(String protocol,
                                                             String host,
                                                             String port,
                                                             String userName,
                                                             String password)
                                                      throws DeploymentManagerCreationException
Allocate a connected DeploymentManager. The session will be able to request deployment operations. The session is assumed to be local to the admin server.

Throws:
DeploymentManagerCreationException

getDescriptorUris

public String[] getDescriptorUris(ModuleType type)
Returns module URIs in the application based on module type. If the type is the same as the root module, then the module's file name is returned. Otherwise, the list of uri's returned are relative to the root module. The session must have been initialized prior to using this method.


getDisconnectedDeploymentManager

public static WebLogicDeploymentManager getDisconnectedDeploymentManager()
                                                                  throws DeploymentManagerCreationException
Allocate a disconnected DeploymentManager. The session will not be able to request any deployment operations.

Throws:
DeploymentManagerCreationException

getInstance

public static SessionHelper getInstance(WebLogicDeploymentManager dm)
get a SessionHelper for a DeploymentManager


getJMSDescriptor

public weblogic.j2ee.descriptor.wl.JMSBean getJMSDescriptor(String name)
                                                     throws ConfigurationException,
                                                            FileNotFoundException
Throws:
ConfigurationException
FileNotFoundException

getModuleInfo

public ModuleInfo getModuleInfo()
                         throws IOException,
                                ConfigurationException
Collects module information based on an application's structure configuration.

Returns:
Hierarchical objects matching the application structure.
Throws:
IOException
ConfigurationException

getPlan

public File getPlan()
The deployment plan.

Returns:
location of deployment plan.

getRemoteDeploymentManager

public static WebLogicDeploymentManager getRemoteDeploymentManager(String host,
                                                                   String port,
                                                                   String userName,
                                                                   String password)
                                                            throws DeploymentManagerCreationException
Allocate a connected DeploymentManager. The session will be able to request deployment operations. The session is assumed to be remote to the admin server.

Throws:
DeploymentManagerCreationException

getRemoteDeploymentManager

public static WebLogicDeploymentManager getRemoteDeploymentManager(String protocol,
                                                                   String host,
                                                                   String port,
                                                                   String userName,
                                                                   String password)
                                                            throws DeploymentManagerCreationException
Allocate a connected DeploymentManager. The session will be able to request deployment operations. The session is assumed to be remote to the admin server.

Throws:
DeploymentManagerCreationException

getTarget

public Target getTarget(weblogic.management.configuration.TargetMBean target)
Given a TargetMBean, returns a jsr88 Target object


initializeConfiguration

public void initializeConfiguration()
                             throws ConfigurationException,
                                    IOException,
                                    InvalidModuleException
Populates the configuration based on current values of this object's properties.

Throws:
ConfigurationException
IOException
InvalidModuleException

inspect

public void inspect()
             throws IOException,
                    InvalidModuleException,
                    ConfigurationException
Creates DeployableObject's for the application without parsing most deployment descriptors. Hence some descriptor problems may not be detected until they are first accessed through WebLogicDeployableObject.getDDBeanRoot().

Throws:
IOException
InvalidModuleException
ConfigurationException

isFullInit

public boolean isFullInit()
Indicates whether initializeConfiguration() should perform a full initialization of the session. A full initialization involves filling out all DConfigBeans for the application configuration. The alternative is for initializeConfiguration() to only access the root elements. This is much faster for large applications. The default is true.


isUpdatePlanVersion

public boolean isUpdatePlanVersion()
Indicates whether the plan version should be updated automatically prior to saving a new plan. This will only work if the plan's current version is either null (no version) or in a float format (eg 1.0)


saveApplicationRoot

public void saveApplicationRoot()
                         throws IOException,
                                ConfigurationException,
                                IllegalStateException
Saves all application artifacts, using a new app root structure. This updates all associated properties accordingly, placing all artifacts under the root directory specified in getApplicationRoot().

Throws:
IOException - for any IO errors
ConfigurationException - if there are problems with the application descriptors
IllegalStateException - if initializeConfiguration() has not been invoked

savePlan

public void savePlan()
              throws IllegalStateException,
                     ConfigurationException,
                     FileNotFoundException
Saves new copy of deployment plan along with any external documents in the plan directory. The new plan is saved to the location specified by getPlan(). The plan directory is specified in the plan itself.

Throws:
IllegalStateException - if initializeConfiguration() has not been invoked
ConfigurationException - if there are problems with the application descriptors
FileNotFoundException - if the current plan is a directory

setApplication

public void setApplication(File application)
Establishes location of the application. May implicitly establish location of application install root directory and deployment plan if parent directory is "app".

Parameters:
application - specifies the location of the applications files.

setApplicationRoot

public void setApplicationRoot(File root)
Establishes installation root for the application and plan information. May implicitly establish locations for the archive and deployment plan.

Parameters:
root - is application installation root directory.

setDebug

public void setDebug()
Turn on debugging.


setFullInit

public void setFullInit(boolean fullInit)
Specifies the amount of work involved in initializeConfiguration(). This should be set to true (the default) if the goal is to look up and update individual elements in the configuration descriptors. If the goal is to build a plan template, then this should be set to false.

Parameters:
fullInit -

setPlan

public void setPlan(File plan)
Establishes location of the deployment plan. May implicitly establish location of application install root directory if parent directory is "plan".

Parameters:
plan - specifies the location of the deployment plan.

setUpdatePlanVersion

public void setUpdatePlanVersion(boolean updatePlanVersion)

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs90
Copyright 2005 BEA Systems Inc.