示例#1
0
 protected <T> T createViewInstanceProxy(
     final Class<T> viewInterface,
     final Map<Object, Object> contextData,
     final ServiceName serviceName) {
   final ServiceController<?> serviceController =
       CurrentServiceContainer.getServiceContainer().getRequiredService(serviceName);
   final ComponentView view = (ComponentView) serviceController.getValue();
   final ManagedReference instance = view.createInstance(contextData);
   return viewInterface.cast(instance.getInstance());
 }
示例#2
0
 private ObjectFactory factoryFromReference(
     final Reference reference, final ClassLoader classLoader, final Hashtable<?, ?> environment)
     throws Exception {
   try {
     final Class<?> factoryClass = classLoader.loadClass(reference.getFactoryClassName());
     ObjectFactory factory = ObjectFactory.class.cast(factoryClass.newInstance());
     if (factory instanceof ServiceAwareObjectFactory) {
       ((ServiceAwareObjectFactory) factory)
           .injectServiceRegistry(CurrentServiceContainer.getServiceContainer());
     }
     return factory;
   } catch (Throwable t) {
     throw MESSAGES.objectFactoryCreationFailure(t);
   }
 }
示例#3
0
 public EJBHome getEJBHome() throws IllegalStateException {
   if (ejbHome == null) {
     throw new IllegalStateException(
         "Bean " + getComponentName() + " does not have a Home interface");
   }
   final ServiceController<?> serviceController =
       CurrentServiceContainer.getServiceContainer().getRequiredService(ejbHome);
   final ComponentView view = (ComponentView) serviceController.getValue();
   final String locatorAppName = earApplicationName == null ? "" : earApplicationName;
   return EJBClient.createProxy(
       new EJBHomeLocator<EJBHome>(
           (Class<EJBHome>) view.getViewClass(),
           locatorAppName,
           moduleName,
           getComponentName(),
           distinctName));
 }
 @SuppressWarnings("unchecked")
 private static ServiceController<BasicComponent> getComponentController(
     final ServiceName componentName) {
   return (ServiceController<BasicComponent>)
       CurrentServiceContainer.getServiceContainer().getService(componentName);
 }
 @Override
 public ServiceRegistry getServiceRegistry() {
   return CurrentServiceContainer.getServiceContainer();
 }