BEA Systems, Inc.

com.beasys.commerce.axiom.util.weblogic.helper
Class WebLogicHelper

java.lang.Object
  |
  +--com.beasys.commerce.axiom.util.weblogic.helper.WebLogicHelper

public class WebLogicHelper
extends java.lang.Object
implements ToolkitConstants

Single point of access to the application server. This should make it easy to swap out servers, and processes.


Fields inherited from interface com.beasys.commerce.axiom.util.ToolkitConstants
DEFAULT_ID_CACHE, DEFAULT_ID_PROCEDURE, DEFAULT_JDBC_POOL_NAME, DEFAULT_JTS_POOL_NAME, DEFAULT_LOGGING_LEVEL, DEFAULT_WEBLOGIC_HOST, DEFAULT_WEBLOGIC_PORT, ID_CACHE, ID_PROCEDURE, JDBC_POOL_NAME, JTS_POOL_NAME, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_SECURITY, LOG_WARNING, LOGGING_LEVEL, WEBLOGIC_HOST, WEBLOGIC_PORT
 
Method Summary
 void finalize()
          Destructor.
 int getBuild()
          Get the WebLogic version.
 java.sql.Connection getConnection()
          Get a connection to a pooled database connection in Weblogic.
 weblogic.event.common.EventServicesDef getEvents()
          Get the T3 events service.
static WebLogicHelper getInstance()
          Get the singleton instance.
 java.sql.Connection getJDBCConnection()
          Get a straight JDBC connection.
 java.sql.Connection getJDBCConnection(java.lang.String myPoolName)
          Get a straight JDBC connection.
 java.sql.Connection getJtsConnection()
          Get connection.
 long getNewId()
          Get a unique id for a schema.
 long getNewId(java.lang.String anId)
          Get a unique id for a given id.
 java.util.Properties getProperties(java.lang.String aPropertyName, java.lang.String aPropertySubName)
          Get properties for a weblogic entry.
 java.lang.Object getService(java.lang.String aLookupName)
          Connect to a reference in JNDI referred to by the lookup name.
 weblogic.time.common.TimeServicesDef getTime()
          Get the T3 time service.
 java.lang.String getWebLogicProperty(java.lang.String aPropertyName)
          Helper method for getting a weblogic property.
 java.lang.String getWebLogicProperty(java.lang.String aPropertyName, java.lang.String aDefault)
          Helper method for getting a weblogic property.
 void log(int aLevel, java.lang.String aMsg)
          Write to the weblogic logs, with extra information added.
 void log(int aLevel, java.lang.String appName, java.lang.String aMsg)
          Write to the weblogic logs, with extra information added.
 void log(java.lang.String aMsg)
          Write to the weblogic logs, with extra information added.
 void setupConnection()
          creates a T3Client connection to the Tengah server, creates a jndi context to lookup the TRVClientServices object, and creates a TRVClient
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

finalize

public void finalize()
              throws java.lang.Throwable
Destructor.

getInstance

public static WebLogicHelper getInstance()
Get the singleton instance.
Returns:
WebLogicHelper

getEvents

public weblogic.event.common.EventServicesDef getEvents()
Get the T3 events service.
Returns:
EventServicesDef the event services.

getTime

public weblogic.time.common.TimeServicesDef getTime()
Get the T3 time service.
Returns:
TimeServicesDef the time services.

setupConnection

public void setupConnection()
                     throws ToolkitException
creates a T3Client connection to the Tengah server, creates a jndi context to lookup the TRVClientServices object, and creates a TRVClient
Throws:
ToolkitException - holder for any exception

getService

public java.lang.Object getService(java.lang.String aLookupName)
                            throws ToolkitException
Connect to a reference in JNDI referred to by the lookup name.
Parameters:
String - the lookup name.
Returns:
Object the object referenced by the name. Use this to get handles to Home interfaces, RMI objects, etc.
Throws:
ToolkitException - holder for any exception

log

public void log(java.lang.String aMsg)
Write to the weblogic logs, with extra information added. The granularity is defined in the properties file.
Parameters:
String - the message, if null it will ignore.

log

public void log(int aLevel,
                java.lang.String aMsg)
Write to the weblogic logs, with extra information added. The granularity is defined in the properties file.
Parameters:
int - aLevel Possible error levels are: FrameworkConstants.LOG_DEBUG FrameworkConstants.LOG_INFO FrameworkConstants.LOG_WARNING FrameworkConstants.LOG_ERROR FrameworkConstants.LOG_FATAL FrameworkConstants.LOG_SECURITY
String - the message, if null it will ignore.

getBuild

public int getBuild()
Get the WebLogic version.
Returns:
the version.

log

public void log(int aLevel,
                java.lang.String appName,
                java.lang.String aMsg)
Write to the weblogic logs, with extra information added. The granularity is defined in the properties file.
Parameters:
int - aLevel Possible error levels are: FrameworkConstants.LOG_DEBUG FrameworkConstants.LOG_INFO FrameworkConstants.LOG_WARNING FrameworkConstants.LOG_ERROR FrameworkConstants.LOG_FATAL FrameworkConstants.LOG_SECURITY
appName - the name of the application logging the message
String - the message, if null it will ignore.

getConnection

public java.sql.Connection getConnection()
                                  throws ToolkitException,
                                         java.sql.SQLException
Get a connection to a pooled database connection in Weblogic.
Returns:
Connection pooled connection

getJDBCConnection

public java.sql.Connection getJDBCConnection()
                                      throws ToolkitException,
                                             java.sql.SQLException
Get a straight JDBC connection.
Returns:
Connection
Throws:
ToolkitException -  
SQLException -  

getJDBCConnection

public java.sql.Connection getJDBCConnection(java.lang.String myPoolName)
                                      throws ToolkitException,
                                             java.sql.SQLException
Get a straight JDBC connection.
Parameters:
myPoolName - name of the JDBC pool to return a connection for.
Returns:
Connection
Throws:
ToolkitException -  
SQLException -  

getJtsConnection

public java.sql.Connection getJtsConnection()
                                     throws ToolkitException,
                                            java.sql.SQLException
Get connection.
Returns:
Connection
Throws:
ToolkitException -  
SQLException -  

getNewId

public long getNewId()
              throws ToolkitException
Get a unique id for a schema.
Returns:
;pmg the new id.

getNewId

public long getNewId(java.lang.String anId)
              throws ToolkitException
Get a unique id for a given id.
Parameters:
anId - the table name, bean name, whatever you want to keep track of unique ids for.
Returns:
long the new id.

getWebLogicProperty

public java.lang.String getWebLogicProperty(java.lang.String aPropertyName,
                                            java.lang.String aDefault)
Helper method for getting a weblogic property.
Parameters:
the - property name.
Returns:
the value, if null, will return default value.

getWebLogicProperty

public java.lang.String getWebLogicProperty(java.lang.String aPropertyName)
Helper method for getting a weblogic property.
Parameters:
the - property name.
Returns:
the value, can be null

getProperties

public java.util.Properties getProperties(java.lang.String aPropertyName,
                                          java.lang.String aPropertySubName)
                                   throws java.io.IOException
Get properties for a weblogic entry. For exampe if you were looking for the properties of a connection pool. You would call this method with WebLogicHelper.getInstance().getProperties("weblogic.jdbc.connectionPool", "commercePool");
Parameters:
aPropertyName - handle to find all references for a property.
aPropertySubName - how to narrow all the references down to the one you are looking for.
Returns:
Properties the properties for a given entry.
Throws:
IOException - error loading into java.util.Properties

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved