[jboss-dev-forums] [Design of POJO Server] - Getting runtime component name from attachment

alesj do-not-reply at jboss.com
Thu Oct 4 14:53:15 EDT 2007


Is there a better way of doing this:

  | public class BasicMetaDataNameProvider implements MetaDataNameProvider
  | {
  |    public Object getRuntimeComponentName(Serializable attachment)
  |    {
  |       if (attachment instanceof BeanMetaData)
  |       {
  |          BeanMetaData beanMetaData = (BeanMetaData)attachment;
  |          return beanMetaData.getName();
  |       }
  |       else if (attachment instanceof ServiceMetaData)
  |       {
  |          ServiceMetaData serviceMetaData = (ServiceMetaData)attachment;
  |          return serviceMetaData.getObjectName().getCanonicalName();
  |       }
  |       throw new IllegalArgumentException("Cannot handle attachment of type: " + attachment.getClass());
  |    }
  | }
  | 

Since I quickly stumbled upon this:

  | java.lang.IllegalArgumentException: Cannot handle attachment of type: class org.jboss.resource.metadata.mcf.LocalDataSourceDeploymentMetaData
  | 	at org.jboss.profileservice.management.BasicMetaDataNameProvider.getRuntimeComponentName(BasicMetaDataNameProvider.java:49)
  | 	at org.jboss.profileservice.management.KernelBusRuntimeComponentDispatcher.dispatch(KernelBusRuntimeComponentDispatcher.java:52)
  | 	at org.jboss.profileservice.management.ManagementViewImpl.updateComponent(ManagementViewImpl.java:659)
  | 
And by looking at LocalDataSourceDeploymentMetaData, I didn't see anything that would resemble some component's name. 
Only if I pulled out what is under its jndi name?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091698#4091698

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091698



More information about the jboss-dev-forums mailing list