return EASYBEANS_ROOT;
} else if (EZBContainer.class.isAssignableFrom(clazz)) {
// The object is an EJB container.
EZBContainer container = (EZBContainer) instance;
// Get the archive name (remove all character before the last slash/antislash).
String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");
// Compute the application id.
return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName;
} else if (Factory.class.isAssignableFrom(clazz)) {
// The object is a bean factory.
Factory<?, ?> factory = (Factory<?, ?>) instance;
EZBContainer container = factory.getContainer();
// Get the archive name (remove all character before the last slash/antislash).
String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");
// Get the bean class name (remove all character before the last point).
String factoryName = factory.getClassName().replaceAll("(.*\\.)", "");
// Compute the bean id.
return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName + "/" + factoryName;
} else {
throw new java.lang.IllegalArgumentException("Name is not define for argument of type " + instance.getClass());
}
}