// Obtain annotations
RemoteBindings remoteBindings = this.getAnnotation(RemoteBindings.class);
RemoteBinding remoteBinding = this.getAnnotation(RemoteBinding.class);
RemoteHomeBinding remoteHomeBinding = this.getAnnotation(RemoteHomeBinding.class);
LocalHomeBinding localHomeBinding = this.getAnnotation(LocalHomeBinding.class);
// LocalBinding localBinding = this.getAnnotation(LocalBinding.class); // < No LocalBindingMetaData?
// Create a Set to hold RemoteBindings
Set<RemoteBinding> remoteBindingsSet = new HashSet<RemoteBinding>();
// Populate Set with Remote Bindings
if (remoteBindings != null)
{
for (RemoteBinding binding : remoteBindings.value())
{
remoteBindingsSet.add(binding);
}
}
if (remoteBinding != null)
{
remoteBindingsSet.add(remoteBinding);
}
// Ensure remote bindings metadata is not null
List<RemoteBindingMetaData> rbmd = this.getMetaData().getRemoteBindings();
if (rbmd == null || rbmd.size() == 0)
{
rbmd = new ArrayList<RemoteBindingMetaData>();
this.getMetaData().setRemoteBindings(rbmd);
}
// For each remote binding, populate metadata
for (RemoteBinding binding : remoteBindingsSet)
{
RemoteBindingMetaData md = new RemoteBindingMetaData();
md.setClientBindUrl(binding.clientBindUrl());
md.setInterceptorStack(binding.interceptorStack());
md.setJndiName(binding.jndiBinding());
md.setProxyFactory(binding.factory());
//TODO binding.invokerName?
rbmd.add(md);
}
// Populate metadata for @RemoteHomeBinding
if (remoteHomeBinding != null)
{
this.getMetaData().setHomeJndiName(remoteHomeBinding.jndiBinding());
}
// Populate metadata for @LocalHomeBinding
if (localHomeBinding != null)
{
this.getMetaData().setLocalHomeJndiName(localHomeBinding.jndiBinding());
}
/*
* End Temporary Hack
*/