Web Dynpro API Documentation

com.sap.tc.webdynpro.progmodel.model.api
Class WDModelFactory

java.lang.Object
  |
  +--com.sap.tc.webdynpro.progmodel.model.api.WDModelFactory

public class WDModelFactory
extends java.lang.Object

Factory for Web Dynpro Models. Model instances are referenced by their implementing class and can be assigned a specific scope (see WDModelScopeType) and instance id.

Version:
$Id: //tc/WebDynproRuntime/630_VAL_REL/src/_webdynpro_progmodel/java/com/sap/tc/webdynpro/progmodel/model/api/WDModelFactory.java#3 $

Constructor Summary
WDModelFactory()
           
 
Method Summary
static java.lang.String getGuiHostIfBackendDebuggingForApplicationIsEnabled(java.lang.String applicationName)
          returns the name of the computer hosting the Debugger Client Process if debugging for the given application is enabled.
static IWDModel getModelInstance(java.lang.Class modelClazz)
          factory method, which returns an instance within the default scope representing a specific model type (param modelClazz) If no instance of type modelClazz exists, a new instance is created and added within the default scope.
static IWDModel getModelInstance(java.lang.Class modelClazz, java.lang.String modelInstanceId)
          factory method, which returns an instance within the default scope representing a specific model type (param modelClazz) having the specific name or id (param modelInstanceId) If no instance with the given parameters exists, a new instance is created and added within the default scope keyed by the modelInstanceId Only one instance of a model can exist within a single scope using the same modelInstanceId e.g.
static IWDModel getModelInstance(java.lang.Class modelClazz, WDModelScopeType scope)
          factory method, which returns an instance within the scope of the current thread's application instance representing a specific model type (param modelClazz) If no instance of the Class modelClazz within the given scope exists, a new instance is created and added within the given scope.
static IWDModel getModelInstance(java.lang.Class modelClazz, WDModelScopeType scope, java.lang.String modelInstanceId)
          factory method, which returns an instance representing: 1) a specific model type (param modelClazz) 2) within the scope as defined by the ModelScope parameter (param scope) 3) having the specific name or id (param modelInstanceId) If no instance with the given parameters exists, a new instance is created and added within the given scope keyed by the modelInstanceId Only one instance of a model can exist within a single scope using the same modelInstanceId e.g.
static boolean getTestMode()
          This method sets the environment in the test mode state.
static WDModelScopeType lookupDefaultScopeForModel(java.lang.Class modelClazz)
          looksup the default scope of a model
static void reassignModel(IWDModel model, WDModelScopeType newScope, java.lang.String newInstanceId)
          reassigns an existing model to a new scope and/or instanceId: returns an instance with the new scope and instanceID if a model instance with the new scope and instanceID already exists, a WDModelException is thrown Only one instance of a model can exist within a single scope using the same modelInstanceId
static void registerDefaultScopeForModel(java.lang.Class modelClazz, WDModelScopeType scope)
          registers the default scope of a model in the ModelFactory
static IWDModel registerModelInstanceInScope(IWDModel modelInstance, WDModelScopeType scope)
          registers a model instance in the appropriate scope.
static java.lang.String setBackendDebugModeForApplication(java.lang.String applicationName, java.lang.String guiHost, boolean turnDebugOn)
          allows enabling or disabling backend debugging for a specific application on a specific host if applicationName is null, then debugging is enabled for all applications in the vm
static void setTestMode(boolean testing)
          This method sets the environment in the test mode state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WDModelFactory

public WDModelFactory()
Method Detail

getModelInstance

public static IWDModel getModelInstance(java.lang.Class modelClazz)
factory method, which returns an instance within the default scope representing a specific model type (param modelClazz) If no instance of type modelClazz exists, a new instance is created and added within the default scope. This is the default instance having no specific modelInstanceId. Only one instance of a model can exist within the default scope having no specific modelInstanceId e.g. getModelInstance(MySpecialRFCAdapterModel.class)
Parameters:
modelClazz - the specific model type class
Returns:
the created model instance

getModelInstance

public static IWDModel getModelInstance(java.lang.Class modelClazz,
                                        java.lang.String modelInstanceId)
factory method, which returns an instance within the default scope representing a specific model type (param modelClazz) having the specific name or id (param modelInstanceId) If no instance with the given parameters exists, a new instance is created and added within the default scope keyed by the modelInstanceId Only one instance of a model can exist within a single scope using the same modelInstanceId e.g. getModelInstance(MySpecialRFCAdapterModel.class)
Parameters:
modelClazz - the specific model type class
modelInstanceId - if more than one instance of a model is used in a single scope, this represents the name or id of the model instance.
Returns:
the created model instance

getModelInstance

public static IWDModel getModelInstance(java.lang.Class modelClazz,
                                        WDModelScopeType scope)
factory method, which returns an instance within the scope of the current thread's application instance representing a specific model type (param modelClazz) If no instance of the Class modelClazz within the given scope exists, a new instance is created and added within the given scope. This is the default instance having no specific modelInstanceId. Only one instance of a model can exist within a single scope e.g. getModelInstance(MySpecialRFCAdapterModel.class)
Parameters:
modelClazz - the specific model type class
scope - the ModelScope, which defines the maximum lifespan of the model
Returns:
the created model instance

getModelInstance

public static IWDModel getModelInstance(java.lang.Class modelClazz,
                                        WDModelScopeType scope,
                                        java.lang.String modelInstanceId)
factory method, which returns an instance representing: 1) a specific model type (param modelClazz) 2) within the scope as defined by the ModelScope parameter (param scope) 3) having the specific name or id (param modelInstanceId) If no instance with the given parameters exists, a new instance is created and added within the given scope keyed by the modelInstanceId Only one instance of a model can exist within a single scope using the same modelInstanceId e.g. getModel(RFCAdapterModel.class, ModelScope.APPLICATION)
Parameters:
modelClazz - the specific model type class
scope - the ModelScope, which defines the maximum lifespan of the model
modelInstanceId - if more than one instance of a model is used in a single scope, this represents the name or id of the model instance.
Returns:
the model instance (created if not already previously instantiated)

reassignModel

public static void reassignModel(IWDModel model,
                                 WDModelScopeType newScope,
                                 java.lang.String newInstanceId)
                          throws WDModelException
reassigns an existing model to a new scope and/or instanceId: returns an instance with the new scope and instanceID if a model instance with the new scope and instanceID already exists, a WDModelException is thrown Only one instance of a model can exist within a single scope using the same modelInstanceId
Parameters:
model - the model instance
newScope - WDModelScopeType, which defines the maximum lifespan of the model, null will not change the scope!
newInstanceId - if more than one instance of a model is used in a single scope, this represents the name or id of the model instance!
Throws:
WDModelException - if the newScope is null or if a model instance already exists with the new scope and modelInstanceId

setTestMode

public static void setTestMode(boolean testing)
This method sets the environment in the test mode state. The test mode is intended for internal testing. It enables them to run without the complete Web Dynpro enviroment. (In detail: The session services are not used and the scopeMaintainer is always the VM scope.)

getTestMode

public static boolean getTestMode()
This method sets the environment in the test mode state. The test mode is intended for internal testing. It enables them to run without the complete Web Dynpro enviroment. (In detail: The session services are not used and the scopeMaintainer is always the VM scope.)

registerModelInstanceInScope

public static IWDModel registerModelInstanceInScope(IWDModel modelInstance,
                                                    WDModelScopeType scope)
registers a model instance in the appropriate scope. This instance will be used by all model classes of the current application instance running in the same scope and modelInstanceId as the model instance being registered via this method.
Parameters:
modelInstance - the IWDModel instance to be registered
scope - WDModelScopeType (e.g. TASK_SCOPE, APPLIATION_SCOPE)
Returns:
previousModelInstance previously registered Model Instance or null if none previously registered

setBackendDebugModeForApplication

public static java.lang.String setBackendDebugModeForApplication(java.lang.String applicationName,
                                                                 java.lang.String guiHost,
                                                                 boolean turnDebugOn)
allows enabling or disabling backend debugging for a specific application on a specific host if applicationName is null, then debugging is enabled for all applications in the vm
Parameters:
applicationName - the Name of the Application for which to enable/disable Debugging
guiHost - the name of the Computer hosting the Client application for Debugging
turnDebugOn - true if debugging should be enabled, false if debugging should be disabled
Returns:
the previous guiHost associated with this application

getGuiHostIfBackendDebuggingForApplicationIsEnabled

public static java.lang.String getGuiHostIfBackendDebuggingForApplicationIsEnabled(java.lang.String applicationName)
returns the name of the computer hosting the Debugger Client Process if debugging for the given application is enabled. if applicationName is null, then the guiHost for global debugging of all applications in the vm is returned returns null if debugging is disabled for the given application
Parameters:
applicationName - the Name of the Application for which to check if Debugging is enabled
Returns:
guiHost the name of the Computer hosting the Client application for Debugging

lookupDefaultScopeForModel

public static WDModelScopeType lookupDefaultScopeForModel(java.lang.Class modelClazz)
looksup the default scope of a model
Parameters:
modelClazz - the class of the model, for which to look up the default scope
Returns:
scope the default scope to use for instances of the given model (specified by class of model)

registerDefaultScopeForModel

public static void registerDefaultScopeForModel(java.lang.Class modelClazz,
                                                WDModelScopeType scope)
registers the default scope of a model in the ModelFactory
Parameters:
modelClazz - the class of the model, for which to set the default scope
scope - the default scope to use for instances of the given model (specified by class of model)

Web Dynpro API Documentation

Copyright © 2004 SAP AG. Automatically generated Thu Mar 3 2005, 22:15