JBoss development,
A new message was posted in the thread "Externalizing Scope: Resolving EJB References
and Endpoints":
http://community.jboss.org/message/525610#525610
Author : Andrew Rubinger
Profile :
http://community.jboss.org/people/ALRubinger
Message:
--------------------------------------------------------------
https://jira.jboss.org/jira/browse/EJBTHREE-2011
Client usage is shown in the ClientUsageUnitTest:
/**
* Simple demonstration of client contracts {@link SessionManager}
* to prove / document its use
*
* @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
* @version $Revision: $
*/
public class ClientUsageUnitTest
{
/**
* A mock {@link SessionManagerFactory} which is represented to the compiler
* as type {@link Object} because JNDI lookups will provide no type information
*/
private static Object jndiEntry = new SessionManagerFactory()
{
@Override
public <T> SessionManager<T> get(Class<T> businessInterface)
throws IllegalArgumentException
{
return new SessionManager<T>()
{
@Override
public T create(Class<T> beanInterface) throws IllegalArgumentException
{
// TODO Auto-generated method stub
return null;
}
@Override
public boolean exists(T proxy) throws IllegalArgumentException
{
// TODO Auto-generated method stub
return false;
}
@Override
public void remove(T proxy) throws NoSuchEJBException
{
}
};
}
};
/**
* Shows the client usage of {@link SessionManagerFactory} and
* {@link SessionManager}; doesn't really test anything (after all this
* is an API component).
*/
@Test
public void showClientUsage()
{
// This step mocks a JNDI lookup to a factory specific to a SFSB
final SessionManagerFactory factory = (SessionManagerFactory) jndiEntry;
// Get a manager specific to a bean interface for the SFSB
final SessionManager<String> manager = factory.get(String.class);
/*
* Invoke its operations in a typesafe way
*/
// Create a new session
final String created = manager.create(String.class);
// Session exists?
manager.exists(created);
// Remove the session
manager.remove(created);
}
}
Is this the view we'd like to proceed?
S,
ALR
--------------------------------------------------------------
To reply to this message visit the message page:
http://community.jboss.org/message/525610#525610