Methods Summary |
---|
private java.lang.Class | getDefaultRemoteProxyFactory()
Class factory;
if (container instanceof StatefulContainer)
{
if (advisor.resolveAnnotation(Clustered.class) != null)
{
factory = StatefulClusterProxyFactory.class;
}
else
{
factory = StatefulRemoteProxyFactory.class;
}
}
else if (container instanceof ServiceContainer)
{
//TODO Implement clustering
factory = ServiceRemoteProxyFactory.class;
}
else
{
if (advisor.resolveAnnotation(Clustered.class) != null)
{
factory = StatelessClusterProxyFactory.class;
}
else
{
factory = StatelessRemoteProxyFactory.class;
}
}
return factory;
|
public java.util.List | getProxyFactories() return proxyFactories;
|
public void | initializeLocalBindingMetadata()
localBinding = (LocalBinding) advisor.resolveAnnotation(LocalBinding.class);
if (localBinding == null)
{
if (ProxyFactoryHelper.getLocalInterfaces(container) != null)
{
localBinding = new LocalBindingImpl(ProxyFactoryHelper.getLocalJndiName(container));
advisor.getAnnotations().addClassAnnotation(LocalBinding.class, localBinding);
}
}
|
public void | initializeRemoteBindingMetadata()
remoteBindings = (RemoteBindings) advisor.resolveAnnotation(RemoteBindings.class);
if (remoteBindings == null)
{
RemoteBinding binding = (RemoteBinding) advisor.resolveAnnotation(RemoteBinding.class);
if (binding == null)
{
log.debug("no declared remote bindings for : " + container.getEjbName());
if (ProxyFactoryHelper.getRemoteInterfaces(container) != null)
{
log.debug("there is remote interfaces for " + container.getEjbName());
String jndiName = ProxyFactoryHelper.getDefaultRemoteJndiName(container);
log.debug("default remote binding has jndiName of " + jndiName);
String uri = ""; // use the default
Class factory = null;
factory = getDefaultRemoteProxyFactory();
RemoteBinding[] list = {new RemoteBindingImpl(jndiName, "", uri, factory)};
remoteBindings = new RemoteBindingsImpl(list);
advisor.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
}
}
else
{
RemoteBinding[] list = {binding};
remoteBindings = new RemoteBindingsImpl(list);
advisor.getAnnotations().addClassAnnotation(RemoteBindings.class, remoteBindings);
}
}
|
public void | start()
if (remoteBindings != null)
{
RemoteBinding[] list = remoteBindings.value();
for (int i = 0; i < list.length; i++)
{
Class factoryClass = list[i].factory();
if (factoryClass.equals(RemoteProxyFactory.class)) factoryClass = getDefaultRemoteProxyFactory();
RemoteProxyFactory factory = (RemoteProxyFactory) factoryClass.newInstance();
factory.setRemoteBinding(list[i]);
factory.setContainer(container);
factory.start();
proxyFactories.add(factory);
}
}
if (localBinding != null)
{
ProxyFactory factory = null;
if (container instanceof StatefulContainer)
{
factory = new StatefulLocalProxyFactory();
}
else if (container instanceof ServiceContainer)
{
factory = new ServiceLocalProxyFactory();
}
else
{
factory = new StatelessLocalProxyFactory();
}
factory.setContainer(container);
factory.start();
proxyFactories.add(factory);
}
|
public void | stop()
for (int i = 0; i < proxyFactories.size(); i++)
{
ProxyFactory factory = (ProxyFactory) proxyFactories.get(i);
factory.stop();
}
|