com.sap.conn.jco.ext
Class Environment

java.lang.Object
  extended by com.sap.conn.jco.ext.Environment

public abstract class Environment
extends java.lang.Object

The Environment class is the central anchor for embedding JCo into an existing application (server). Typically, only infrastructure programmers will have the need to deal with that class. Business application logic typically can be developed without knowing the infrastructure. For the infrastrucure embedding you can register, deregister and check for the existence of several components: Configuration providers (DestinationDataProvider, ServerDataProvider), Session Management (SessionReferenceProvider), Password Handler PasswordChangeHandler, and Passport Managers for E2E scenario analysis ({link ClientPassportManager, ServerPassportManager}). Moreover, it allows finding out about the current runtime environment, which might be useful for components that exist in several ones.


Method Summary
static boolean inDW()
          Allows to check, whether the current runtime environment is a DW, which is a flavor of JTS.
static boolean inDWJ()
          Allows to check, whether the current runtime environment is a DWJ, which is a flavor of JTS.
static boolean inEclipsePlugin()
          Allows to check, whether the JCo was loaded as eclipse plugin within the current environment, which means the application is in a standalone environment and probably run in eclipse.
static boolean inJStartup()
          Allows to check, whether the current runtime environment has been started by a Java Startup framework.
static boolean inJTS()
          Allows to check, whether the current runtime environment is a JTS.
static boolean inSAPJ2EE()
          Allows to check, whether the current runtime environment is an SAP J2EE engine.
static boolean inSAPVM()
          Allows to check, whether the current Java virtual machine is a VM provided by SAP.
static boolean inStandalone()
          Allows to check, whether the current runtime environment is a standalone environment, which means it's neither JTS nor SAP J2EE.
static boolean isClientPassportManagerRegistered()
          Checks whether a passport manager for client side communication has already been registered.
static boolean isDestinationDataProviderRegistered()
          Checks whether a provider for destination data has already been registered.
static boolean isPasswordChangeHandlerRegistered()
          Checks whether a PasswordChangeHandler has already been registered.
static boolean isServerDataProviderRegistered()
          Checks whether a provider for server data has already been registered.
static boolean isServerPassportManagerRegistered()
          Checks whether a passport manager for server side communication has already been registered.
static boolean isSessionReferenceProviderRegistered()
          Checks whether a provider for session references has already been registered.
static void registerClientPassportManager(ClientPassportManager passportManager)
          Registers a manager for DSR passports for client side communication.
static void registerDestinationDataProvider(DestinationDataProvider provider)
          Registers a provider for destination data.
static void registerPasswordChangeHandler(PasswordChangeHandler passwordChangeHandler)
          Registers a handler for password change events.
static void registerServerDataProvider(ServerDataProvider provider)
          Registers a provider for destination data.
static void registerServerPassportManager(ServerPassportManager passportManager)
          Registers a manager for DSR passports for server side communication.
static void registerSessionReferenceProvider(SessionReferenceProvider provider)
          Registers a provider for session reference information.
static void unregisterClientPassportManager(ClientPassportManager passportManager)
          Unregisters a manager for DSR passports for client side communication.
static void unregisterDestinationDataProvider(DestinationDataProvider provider)
          Unregisters a provider for destination data.
static void unregisterPasswordChangeHandler(PasswordChangeHandler passwordChangeHandler)
          Unregisters the handler for password change events.
static void unregisterServePassportManager(ServerPassportManager passportManager)
          Unregisters a manager for DSR passports for server side communication.
static void unregisterServerDataProvider(ServerDataProvider provider)
          Unregisters a provider for destination data.
static void unregisterSessionReferenceProvider(SessionReferenceProvider provider)
          Unregisters a provider for session id data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

inSAPVM

public static final boolean inSAPVM()
Allows to check, whether the current Java virtual machine is a VM provided by SAP.

Returns:
true if the Java virtual machine is a VM provided by SAP, false otherwise

inJTS

public static final boolean inJTS()
Allows to check, whether the current runtime environment is a JTS.

Returns:
true if the runtime environment is a JTS, false otherwise

inDW

public static final boolean inDW()
Allows to check, whether the current runtime environment is a DW, which is a flavor of JTS.

Returns:
true if the runtime environment is a DW, false otherwise

inDWJ

public static final boolean inDWJ()
Allows to check, whether the current runtime environment is a DWJ, which is a flavor of JTS.

Returns:
true if the runtime environment is a DWJ, false otherwise

inJStartup

public static final boolean inJStartup()
Allows to check, whether the current runtime environment has been started by a Java Startup framework.

Returns:
true if the runtime environment is a Java Startup framework, false otherwise

inSAPJ2EE

public static final boolean inSAPJ2EE()
Allows to check, whether the current runtime environment is an SAP J2EE engine.

Returns:
true if the runtime environment is a SAP J2EE engine, false otherwise

inStandalone

public static final boolean inStandalone()
Allows to check, whether the current runtime environment is a standalone environment, which means it's neither JTS nor SAP J2EE.

Returns:
true if the runtime environment is standalone, false otherwise

inEclipsePlugin

public static final boolean inEclipsePlugin()
Allows to check, whether the JCo was loaded as eclipse plugin within the current environment, which means the application is in a standalone environment and probably run in eclipse.

Returns:
true if JCo is loaded as eclipse plugin, false otherwise

registerDestinationDataProvider

public static void registerDestinationDataProvider(DestinationDataProvider provider)
Registers a provider for destination data.

Parameters:
provider - the class that provides DestinationData
Throws:
java.lang.IllegalStateException - if a provider is already registered

registerServerDataProvider

public static void registerServerDataProvider(ServerDataProvider provider)
Registers a provider for destination data.

Parameters:
provider - the class that provides DestinationData
Throws:
java.lang.IllegalStateException - if a provider is already registered

registerSessionReferenceProvider

public static void registerSessionReferenceProvider(SessionReferenceProvider provider)
Registers a provider for session reference information.

Parameters:
provider - the class that provides session reference information
Throws:
java.lang.IllegalStateException - if a provider is already registered

unregisterDestinationDataProvider

public static void unregisterDestinationDataProvider(DestinationDataProvider provider)
Unregisters a provider for destination data. It needs to be exactly the object instance that was originally registered. Otherwise it's impossible to deregister it. Note: When your application shall be shutdown, unregister your destination data provider, in order to free used resources.

Parameters:
provider - the original DestinationDataProvider that should be unregistered
Throws:
java.lang.IllegalStateException - if the provider that should be unregistered is not the one that was originally registered

unregisterServerDataProvider

public static void unregisterServerDataProvider(ServerDataProvider provider)
Unregisters a provider for destination data. It needs to be exactly the object instance that was originally registered. Otherwise it's impossible to deregister it.

Parameters:
provider - the class that provides DestinationData
Throws:
java.lang.IllegalStateException - IllegalStateException if the provider that should be unregistered is not the one that was originally registered

unregisterSessionReferenceProvider

public static void unregisterSessionReferenceProvider(SessionReferenceProvider provider)
Unregisters a provider for session id data. It needs to be exactly the object instance that was originally registered. Otherwise it's impossible to unregister it.

Parameters:
provider - the original SessionIdProvider that should be unregistered
Throws:
java.lang.IllegalStateException - if the provider that should be unregistered is not the one that was originally registered

registerClientPassportManager

public static void registerClientPassportManager(ClientPassportManager passportManager)
Registers a manager for DSR passports for client side communication.

Parameters:
passportManager - the class that does client side passport management
Throws:
java.lang.IllegalStateException - if a manager is already registered

unregisterClientPassportManager

public static void unregisterClientPassportManager(ClientPassportManager passportManager)
Unregisters a manager for DSR passports for client side communication. It needs to be exactly the object instance that was originally registered. Otherwise it's impossible to unregister it.

Parameters:
passportManager - the original ClientPassportManager that should be unregistered
Throws:
java.lang.IllegalStateException - if the manager that should be unregistered is not the one that was originally registered

registerServerPassportManager

public static void registerServerPassportManager(ServerPassportManager passportManager)
Registers a manager for DSR passports for server side communication.

Parameters:
passportManager - the class that does server side passport management
Throws:
java.lang.IllegalStateException - if a manager is already registered

unregisterServePassportManager

public static void unregisterServePassportManager(ServerPassportManager passportManager)
Unregisters a manager for DSR passports for server side communication. It needs to be exactly the object instance that was originally registered. Otherwise it's impossible to unregister it.

Parameters:
passportManager - the original ServerPassportManager that should be unregistered
Throws:
java.lang.IllegalStateException - if the manager that should be unregistered is not the one that was originally registered

registerPasswordChangeHandler

public static void registerPasswordChangeHandler(PasswordChangeHandler passwordChangeHandler)
Registers a handler for password change events.

Parameters:
passwordChangeHandler - the class that reacts on password change queries
Throws:
java.lang.IllegalStateException - if a handler is already registered
Since:
JCo 3.0.6

unregisterPasswordChangeHandler

public static void unregisterPasswordChangeHandler(PasswordChangeHandler passwordChangeHandler)
Unregisters the handler for password change events. It needs to be exactly the object instance that was originally registered. Otherwise it's impossible to unregister it.

Parameters:
passwordChangeHandler - the original PasswordChangeHandler that should be unregistered
Throws:
java.lang.IllegalStateException - if the handler that should be unregistered is not the one that was originally registered
Since:
JCo 3.0.6

isDestinationDataProviderRegistered

public static boolean isDestinationDataProviderRegistered()
Checks whether a provider for destination data has already been registered.

Returns:
true if there exists one false otherwise
Since:
JCo 3.0.2

isServerDataProviderRegistered

public static boolean isServerDataProviderRegistered()
Checks whether a provider for server data has already been registered.

Returns:
true if there exists one false otherwise
Since:
JCo 3.0.2

isSessionReferenceProviderRegistered

public static boolean isSessionReferenceProviderRegistered()
Checks whether a provider for session references has already been registered.

Returns:
true if there exists one false otherwise
Since:
JCo 3.0.2

isClientPassportManagerRegistered

public static boolean isClientPassportManagerRegistered()
Checks whether a passport manager for client side communication has already been registered.

Returns:
true if there exists one false otherwise
Since:
JCo 3.0.2

isServerPassportManagerRegistered

public static boolean isServerPassportManagerRegistered()
Checks whether a passport manager for server side communication has already been registered.

Returns:
true if there exists one false otherwise
Since:
JCo 3.0.2

isPasswordChangeHandlerRegistered

public static boolean isPasswordChangeHandlerRegistered()
Checks whether a PasswordChangeHandler has already been registered.

Returns:
true if there exists one false otherwise
Since:
JCo 3.0.6


Copyright © 2008-2014 SAP AG. All Rights Reserved.