Anyframe Core

anyframe.core.locator
Interface IServiceLocator


public interface IServiceLocator

This Interface provides JNDI naming contexts and takes an object through approaching to the JNDI Server or Naming Server.

The object once looked up is saved in cache, and fetched when it is called again. This Service searches objects like as UserTransaction, DataSource, EJBHome Object at JNDI Server to offer them to the client.(Other objects use look up method). Context information of WAS shoud be defined in xconf file of Naming Service. Naming Service uses Cache Service internally, so they should be distributed together.

ServiceLocator

ServiceLocator service has subordinate elements in xml.

Attibute Description REQ/OPT (default value)
name representative name used for finding appropriate context. Requred
key attribute name used for creating InitialContext. Requred
value attribute value corresponding a context. Requred

Configuration Example:

for Weblogic

 
     <bean name="serviceLocator"
        class=anyframe.core.services.utility.IServiceLocator>
        <config:configuration>
                <context name="default" key="java.naming.provider.url" 
                    value="t3://localhost:7001"/>
                <context name="default" key="java.naming.factory.initial" 
                    value="weblogic.jndi.WLInitialContextFactory"/>
                <usertx name="default"  key="javax.transaction.UserTransaction"/>
        </config:configuration>
    </bean>  
 

for Websphere

  
     <bean name="serviceLocator"
        class=anyframe.core.services.utility.IServiceLocator>
        <config:configuration>
                <cache>true</cache>
                <context name="default" key="java.naming.provider.url" 
                   value=" iiop://localhost:2809"/>
                <context name="default" key="java.naming.factory.initial" 
                   value="com.ibm.websphere.naming.WsnInitialContextFactory "/>
                <usertx name="default"  key="javax.transaction.UserTransaction"/>
        </config:configuration>
    </bean>  
 

for Jeus

  
     <bean name="serviceLocator"
        class=anyframe.core.services.utility.IServiceLocator>
        <config:configuration>
                <cache>true</cache>
                <context name="default" key="java.naming.provider.url" 
                  value="localhost:9736"/>
                <context name="default" key="java.naming.factory.initial" 
                  value=" jeus.jndi.JEUSContextFactory "/>
                <usertx name="default"  key=" java:comp/UserTransaction "/>
        </config:configuration>
    </bean>  
 

Author:
SoYon Lim, JongHoon Kim

Field Summary
static Log LOGGER
           
static String ROLE
           
 
Method Summary
 Context getContext(String context)
          Return the Context with the specified name.
 DataSource getDataSource(String dsName)
          Using a default context, get DataSource Object from JNDI Server.
 DataSource getDataSource(String dsName, String context)
          Using a context, get DataSource Object from JNDI Server.
 Object getEJBHome(String ejbName)
          Using a default context, get EJBHome Object from JNDI Server.
 Object getEJBHome(String ejbName, Class classType)
          Using a default context, get EJBHome Object narrow casting from JNDI Server.
 Object getEJBHome(String ejbName, Class classType, String context)
          Using a context, get EJBHome Object narrow casting from JNDI Server.
 Object getEJBHome(String ejbName, String context)
          Using a context, get EJB Home Object from JNDI Server.
 UserTransaction getUserTransaction()
          Using a default context, get UserTransaction Object from JNDI Server.
 UserTransaction getUserTransaction(String context)
          Using a context, get UserTransaction Object from JNDI Server.
 Object lookup(String name)
          Using a default context, get Object from JNDI Server.
 Object lookup(String name, String context)
          Using a context, get Object from JNDI Server.
 

Field Detail

ROLE

static final String ROLE

LOGGER

static final Log LOGGER
Method Detail

getContext

Context getContext(String context)
Return the Context with the specified name.

Parameters:
context - The name of the context.
Returns:
The context with the specified name, or null if no context exists with that name.

getUserTransaction

UserTransaction getUserTransaction()
                                   throws BaseException
Using a default context, get UserTransaction Object from JNDI Server.

Using a default context in configuration files, get UserTransaction Object from JNDI Server to do Naming Service.

Returns:
UserTransaction Object
Throws:
BaseException - if an error occurs

getUserTransaction

UserTransaction getUserTransaction(String context)
                                   throws BaseException
Using a context, get UserTransaction Object from JNDI Server.

Using a defined context in configuration files, get UserTransaction Object from JNDI Server to do Naming Service.

Parameters:
context - context name that exists in configuration files
Returns:
UserTransaction Object
Throws:
BaseException - if an error occurs.

getDataSource

DataSource getDataSource(String dsName)
                         throws BaseException
Using a default context, get DataSource Object from JNDI Server.

Using a defined default context in configuration files, get DataSource Object from JNDI Server to do Naming Service.

Parameters:
dsName - context name that exists in configuration files
Returns:
DataSource Object
Throws:
BaseException - if an error occurs

getDataSource

DataSource getDataSource(String dsName,
                         String context)
                         throws BaseException
Using a context, get DataSource Object from JNDI Server.

Using a defined context in configuration files, get DataSource Object from JNDI Server to do Naming Service.

Parameters:
dsName - assigned JNDI name in dsName JNDI Server
context - context name that exists in configuration files
Returns:
DataSource Object connected to dsName
Throws:
BaseException - if an error occurs

getEJBHome

Object getEJBHome(String ejbName)
                  throws BaseException
Using a default context, get EJBHome Object from JNDI Server.

Using a defined default context in configuration files, get EJBHome Object from JNDI Server to do Naming Service.

Parameters:
ejbName - assigned JNDI name in ejbName JNDI Server
Returns:
EJBHome Object connected to ejbName
Throws:
BaseException - if an error occurs

getEJBHome

Object getEJBHome(String ejbName,
                  String context)
                  throws BaseException
Using a context, get EJB Home Object from JNDI Server.

Using a defined context in configuration files, get EJBHome Object from JNDI Server to do Naming Service.

Parameters:
ejbName - assigned JNDI name in ejbName JNDI Server
context - context name that exists in configuration files
Returns:
EJBHome Object connected to ejbName
Throws:
BaseException - if an error occurs

getEJBHome

Object getEJBHome(String ejbName,
                  Class classType)
                  throws BaseException
Using a default context, get EJBHome Object narrow casting from JNDI Server.

Using a defined default context in configuration files, narrow casting EJBHome Object which is get from JNDI Server to do Naming Service. When EJBHome exists in remote, it make use

Parameters:
ejbName - assigned JNDI name in ejbName JNDI Server
classType - classType narrow casting
Returns:
EJBHome Object connected to ejbName
Throws:
BaseException - if an error occurs

getEJBHome

Object getEJBHome(String ejbName,
                  Class classType,
                  String context)
                  throws BaseException
Using a context, get EJBHome Object narrow casting from JNDI Server.

Using a defined default context in configuration files, narrow casting EJBHome Object which is get from JNDI Server to do Naming Service. When EJBHome exists in remote, it make use

Parameters:
ejbName - assigned JNDI name in ejbName JNDI Server
classType - classType narrow casting
context - context name that exists in configuration files
Returns:
EJBHome Object connected to ejbName
Throws:
BaseException - if an error occurs

lookup

Object lookup(String name)
              throws BaseException
Using a default context, get Object from JNDI Server.

Using a defined default context in configuration files, get Object from JNDI Server to do Naming Service.

Parameters:
name - assigned JNDI name in name JNDI Server
Returns:
Object connected to name
Throws:
BaseException - if an error occurs

lookup

Object lookup(String name,
              String context)
              throws BaseException
Using a context, get Object from JNDI Server.

Using a defined default context in configuration files, get Object from JNDI Server to do Naming Service.

Parameters:
name - assigned JNDI name in name JNDI Server
context - context name that exists in configuration files
Returns:
Object connected to name
Throws:
BaseException - if an error occurs

Anyframe Core

Copyright © 2008-2009 Samsung SDS. All Rights Reserved.