Package org.jboss.as.ee.component

Examples of org.jboss.as.ee.component.ComponentView.createInstance()


    protected <T> T createViewInstanceProxy(final Class<T> viewInterface, final Map<Object, Object> contextData, final ServiceName serviceName) {
        final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(serviceName);
        final ComponentView view = (ComponentView) serviceController.getValue();
        final ManagedReference instance;
        try {
            instance = view.createInstance(contextData);
        } catch (Exception e) {
            //TODO: do we need to let the exception propagate here?
            throw new RuntimeException(e);
        }
        return viewInterface.cast(instance.getInstance());
View Full Code Here


                throw new RuntimeException("More than 1 ejb found for @Ejb reference " + ejb);
            }
            final ViewDescription viewDescription = viewService.iterator().next();
            final ServiceController<?> controller = serviceRegistry.getRequiredService(viewDescription.getServiceName());
            final ComponentView view = (ComponentView) controller.getValue();
            return view.createInstance().createProxy();
        }
    }

    @Override
    public void cleanup() {
View Full Code Here

        if (viewInterface == null)
            throw new IllegalArgumentException("View interface is null");
        if (viewServices.containsKey(viewInterface.getName())) {
            final ServiceController<?> serviceController = CurrentServiceContainer.getServiceContainer().getRequiredService(viewServices.get(viewInterface.getName()));
            final ComponentView view = (ComponentView) serviceController.getValue();
            final ComponentViewInstance instance = view.createInstance(contextData);
            return viewInterface.cast(instance.createProxy());
        } else {
            throw new IllegalStateException("View of type " + viewInterface + " not found on bean " + this);
        }
    }
View Full Code Here

            if (ejbComponentViewInstance == null) {
               final ComponentView ejbView = iocContainer.getBean(ejbName, ComponentView.class);
               if (ejbView == null) {
                  throw new WebServiceException("Cannot find ejb: " + ejbName);
               }
               ejbComponentViewInstance = ejbView.createInstance();
            }
         }
      }

      return ejbComponentViewInstance;
View Full Code Here

    protected <T> T createViewInstanceProxy(final Class<T> viewInterface, final Map<Object, Object> contextData, final ServiceName serviceName) {
        final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(serviceName);
        final ComponentView view = (ComponentView) serviceController.getValue();
        final ManagedReference instance;
        try {
            instance = view.createInstance(contextData);
        } catch (Exception e) {
            //TODO: do we need to let the exception propagate here?
            throw new RuntimeException(e);
        }
        return viewInterface.cast(instance.getInstance());
View Full Code Here

        if (viewServices.containsKey(businessInterface.getName())) {
            final ServiceController<?> serviceController = CurrentServiceRegistry.getServiceRegistry().getRequiredService(viewServices.get(businessInterface.getName()));
            final ComponentView view = (ComponentView) serviceController.getValue();
            final ComponentViewInstance instance;
            if(sessionId != null) {
                instance = view.createInstance(Collections.<Object, Object>singletonMap(StatefulSessionComponent.SESSION_ATTACH_KEY, sessionId));
            } else {
                instance = view.createInstance();
            }
            return (T) instance.createProxy();
        } else {
View Full Code Here

            final ComponentView view = (ComponentView) serviceController.getValue();
            final ComponentViewInstance instance;
            if(sessionId != null) {
                instance = view.createInstance(Collections.<Object, Object>singletonMap(StatefulSessionComponent.SESSION_ATTACH_KEY, sessionId));
            } else {
                instance = view.createInstance();
            }
            return (T) instance.createProxy();
        } else {
            throw new IllegalStateException("View of type " + businessInterface + " not found on bean " + this);
        }
View Full Code Here

        //TODO: this should be cached
        if (viewServices.containsKey(businessInterfaceType.getName())) {
            final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(viewServices.get(businessInterfaceType.getName()));
            final ComponentView view = (ComponentView) serviceController.getValue();
            try {
                return(S) view.createInstance().getInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else {
            throw WeldMessages.MESSAGES.viewNotFoundOnEJB(businessInterfaceType.getName(), ejbName);
View Full Code Here

        }
        if (viewServices.containsKey(businessInterfaceType.getName())) {
            final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(viewServices.get(businessInterfaceType.getName()));
            final ComponentView view = (ComponentView) serviceController.getValue();
            try {
                return (S) view.createInstance(Collections.<Object, Object>singletonMap(SessionID.class, id)).getInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else {
            throw WeldMessages.MESSAGES.viewNotFoundOnEJB(businessInterfaceType.getName(), ejbComponent.getComponentName());
View Full Code Here

    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;
        try {
            instance = view.createInstance(contextData);
        } catch (Exception e) {
            //TODO: do we need to let the exception propagate here?
            throw new RuntimeException(e);
        }
        return viewInterface.cast(instance.getInstance());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.