com.metamatrix.cdk.api
Class EnvironmentUtility

java.lang.Object
  extended by com.metamatrix.cdk.api.EnvironmentUtility

public class EnvironmentUtility
extends java.lang.Object

A utility factory class to create connector environment objects that are normally supplied by the MetaMatrix Server. This utility will create objects that can be used for testing of your connector outside the context of the MetaMatrix Server.


Method Summary
static ConnectorEnvironment createEnvironment(java.util.Properties props)
          Create a ConnectorEnvironment with the specified properties.
static ConnectorEnvironment createEnvironment(java.util.Properties props, boolean stdoutLog)
          Create a ConnectorEnvironment with the specified properties.
static ConnectorEnvironment createEnvironment(java.util.Properties props, ConnectorLogger logger)
          Create a ConnectorEnvironment with the specified properties and logger.
static ExecutionContext createExecutionContext(java.lang.String requestID, java.lang.String partID)
          Create an ExecutionContext and set just the requestID and partID.
static ExecutionContext createExecutionContext(java.lang.String vdbName, java.lang.String vdbVersion, java.lang.String user, java.io.Serializable trustedToken, java.io.Serializable executionPayload, java.lang.String connectionID, java.lang.String connectorID, java.lang.String requestID, java.lang.String partID, boolean useResultSetCache)
          Create an ExecutionContext and set all of the parts.
static ExecutionContext createSecurityContext(java.lang.String user)
          Create an ExecutionContext and set just the user name.
static ExecutionContext createSecurityContext(java.lang.String vdbName, java.lang.String vdbVersion, java.lang.String user, java.io.Serializable trustedToken)
          Create an ExecutionContext and set just the security parts.
static ConnectorLogger createStdoutLogger(int logLevel)
          Create a ConnectorLogger that prints to STDOUT at the specified log level (and above).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createStdoutLogger

public static ConnectorLogger createStdoutLogger(int logLevel)
Create a ConnectorLogger that prints to STDOUT at the specified log level (and above).

Parameters:
logLevel - The logLevel as defined in SysLogger.
Returns:
A logger

createEnvironment

public static ConnectorEnvironment createEnvironment(java.util.Properties props,
                                                     ConnectorLogger logger)
Create a ConnectorEnvironment with the specified properties and logger.

Parameters:
props - The properties to put in the environment
logger - The logger to use
Returns:
A ConnectorEnvironment instance

createEnvironment

public static ConnectorEnvironment createEnvironment(java.util.Properties props)
Create a ConnectorEnvironment with the specified properties. A default logger will be created that prints logging to STDOUT for INFO level and above.

Parameters:
props - The properties to put in the environment
Returns:
A ConnectorEnvironment instance

createEnvironment

public static ConnectorEnvironment createEnvironment(java.util.Properties props,
                                                     boolean stdoutLog)
Create a ConnectorEnvironment with the specified properties. A default logger will be created that prints logging to STDOUT for INFO level and above if stdoutLog is true.

Parameters:
props - The properties to put in the environment
stdoutLog -
Returns:
A ConnectorEnvironment instance

createSecurityContext

public static ExecutionContext createSecurityContext(java.lang.String user)
Create an ExecutionContext and set just the user name. Dummy information will be created for the other parts of the context.

Parameters:
user - User name
Returns:
A SecurityContext / ExecutionContext instance

createSecurityContext

public static ExecutionContext createSecurityContext(java.lang.String vdbName,
                                                     java.lang.String vdbVersion,
                                                     java.lang.String user,
                                                     java.io.Serializable trustedToken)
Create an ExecutionContext and set just the security parts. Dummy information will be created for the other parts of the context.

Parameters:
vdbName - Virtual database name
vdbVersion - Virtual database version
user - User name
trustedToken - Trusted token (passed when creating JDBC Connection)
Returns:
A SecurityContext / ExecutionContext instance

createExecutionContext

public static ExecutionContext createExecutionContext(java.lang.String requestID,
                                                      java.lang.String partID)
Create an ExecutionContext and set just the requestID and partID. Dummy information will be created for the other parts of the context.

Parameters:
requestID - Unique identifier for the user command within the server
partID - Unique identifier for the source command within the context of a requestID
Returns:
A SecurityContext / ExecutionContext instance

createExecutionContext

public static ExecutionContext createExecutionContext(java.lang.String vdbName,
                                                      java.lang.String vdbVersion,
                                                      java.lang.String user,
                                                      java.io.Serializable trustedToken,
                                                      java.io.Serializable executionPayload,
                                                      java.lang.String connectionID,
                                                      java.lang.String connectorID,
                                                      java.lang.String requestID,
                                                      java.lang.String partID,
                                                      boolean useResultSetCache)
Create an ExecutionContext and set all of the parts.

Parameters:
vdbName - Virtual database name
vdbVersion - Virtual database version
user - User name
trustedToken - Trusted token (passed when creating JDBC Connection)
executionPayload - Command payload (passed for each command executed on JDBC Statement)
requestID - Unique identifier for the user command within the server
partID - Unique identifier for the source command within the context of a requestID
connectionID - Unique identifier for the connection through which the command is executed
useResultSetCache - Whether to use ResultSet cache if it is enabled.
Returns:
A SecurityContext / ExecutionContext instance
Since:
4.2


Copyright © 2009. All Rights Reserved.