private Object readResolve() throws ObjectStreamException { ServiceName name = ServiceName.parse(serviceName); ServiceController<?> service = currentServiceContainer().getRequiredService(name); StatefulSessionComponent component = (StatefulSessionComponent) service.getValue(); final Map<Object, Object> context = new HashMap<Object, Object>(); for(final Map.Entry<Object, Object> entry : serializableInterceptors.entrySet()) { context.put(entry.getKey(), entry.getValue()); } context.put(SessionID.class, sessionID); context.put(BasicComponentInstance.INSTANCE_KEY, instance); return component.constructComponentInstance(instance, false, context); }
public static IORSecurityConfigMetaData getCurrent() { return (IORSecurityConfigMetaData) currentServiceContainer().getRequiredService(SERVICE_NAME).getValue(); }
public static ORB getCurrent() { return (ORB) currentServiceContainer().getRequiredService(SERVICE_NAME).getValue(); }
@Override public void setORB(ORB orb) { super.setORB(orb); ServiceContainer container = this.currentServiceContainer(); final ServiceName serverContextServiceName = SSL_CONTEXT_RUNTIME_CAPABILITY.getCapabilityServiceName(serverSSLContextName); this.serverSSLContext = (SSLContext) container.getRequiredService(serverContextServiceName).getValue(); final ServiceName clientContextServiceName = SSL_CONTEXT_RUNTIME_CAPABILITY.getCapabilityServiceName(clientSSLContextName); this.clientSSLContext = (SSLContext) container.getRequiredService(clientContextServiceName).getValue(); }
public Class<?> getEjbObjectType() { if (ejbObjectViewServiceName == null) { return null; } final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(ejbObjectViewServiceName); final ComponentView view = (ComponentView) serviceController.getValue(); return view.getViewClass(); }
public ElytronSASClientInterceptor(final Codec codec) { this.codec = codec; // initialize the authentication context. final ServiceContainer container = this.currentServiceContainer(); if(authenticationContextName != null) { final ServiceName authContextServiceName = AUTHENTICATION_CONTEXT_RUNTIME_CAPABILITY.getCapabilityServiceName(authenticationContextName); this.authContext = (AuthenticationContext) container.getRequiredService(authContextServiceName).getValue(); } else { this.authContext = null; } }
private Object readResolve() throws ObjectStreamException { ServiceController<ComponentView> view = (ServiceController<ComponentView>) currentServiceContainer().getRequiredService(ServiceName.parse(viewName)); try { return view.getValue().createInstance(Collections.<Object, Object>singletonMap(SessionID.class, sessionID)).getInstance(); } catch (Exception e) { throw new RuntimeException(e); } }
@Override protected BeanManagerImpl getBeanManager() { // get the reference to the bean manager on the first invocation if (beanManager == null) { beanManager = BeanManagerProxy.unwrap((BeanManager)currentServiceContainer().getRequiredService(beanManagerServiceName).getValue()); } return beanManager; }
public Class<?> getEjbLocalObjectType() { if (ejbLocalObjectViewServiceName == null) { return null; } final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(ejbLocalObjectViewServiceName); final ComponentView view = (ComponentView) serviceController.getValue(); return view.getViewClass(); }
@Override protected BasicComponentInstance instantiateComponentInstance(Interceptor preDestroyInterceptor, Map<Method, Interceptor> methodInterceptors, Map<Object, Object> context) { // synchronized from getComponentInstance assert Thread.holdsLock(creationLock); if (dependsOn != null) { for (ServiceName serviceName : dependsOn) { final ServiceController<Component> service = (ServiceController<Component>) currentServiceContainer().getRequiredService(serviceName); final Component component = service.getValue(); if (component instanceof SingletonComponent) { ((SingletonComponent) component).getComponentInstance(); } } } return new SingletonComponentInstance(this, preDestroyInterceptor, methodInterceptors); }
private Object readResolve() throws ObjectStreamException { ServiceController<ComponentView> view = (ServiceController<ComponentView>) currentServiceContainer().getRequiredService(ServiceName.parse(viewName)); try { return view.getValue().createInstance().getInstance(); } catch (Exception e) { throw new RuntimeException(e); } }
/** * {@inheritDoc} */ public Subject createSubject(final String authenticationContextName) { AuthenticationContext context; if (authenticationContextName != null && !authenticationContextName.isEmpty()) { final ServiceContainer container = this.currentServiceContainer(); final ServiceName authContextServiceName = AUTHENTICATION_CONTEXT_RUNTIME_CAPABILITY.getCapabilityServiceName(authenticationContextName); context = (AuthenticationContext) container.getRequiredService(authContextServiceName).getValue(); } else { context = getAuthenticationContext(); } final Subject subject = this.createSubject(context); if (ROOT_LOGGER.isTraceEnabled()) { ROOT_LOGGER.subject(subject, Integer.toHexString(System.identityHashCode(subject))); } return subject; }
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 { if(WildFlySecurityManager.isChecking()) { instance = WildFlySecurityManager.doUnchecked(new PrivilegedExceptionAction<ManagedReference>() { @Override public ManagedReference run() throws Exception { return view.createInstance(contextData); } }); } else { 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()); }
public EJBHome getEJBHome() throws IllegalStateException { if (ejbHomeViewServiceName == null) { throw EjbLogger.ROOT_LOGGER.beanHomeInterfaceIsNull(getComponentName()); } final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(ejbHomeViewServiceName); final ComponentView view = (ComponentView) serviceController.getValue(); final String locatorAppName = earApplicationName == null ? "" : earApplicationName; return EJBClient.createProxy(createHomeLocator(view.getViewClass().asSubclass(EJBHome.class), locatorAppName, moduleName, getComponentName(), distinctName)); }
@Override public CallbackHandler createCallbackHandler(final Callback callback) { assert callback != null; // TODO switch to use the elytron security domain once the callback has that info available. final String securityDomainName = callback.getDomain(); // get domain reference from the service container and create the callback handler using the domain. if (securityDomainName != null) { final ServiceContainer container = this.currentServiceContainer(); final ServiceName securityDomainServiceName = SECURITY_DOMAIN_RUNTIME_CAPABILITY.getCapabilityServiceName(securityDomainName); final SecurityDomain securityDomain = (SecurityDomain) container.getRequiredService(securityDomainServiceName).getValue(); return new ElytronCallbackHandler(securityDomain, callback); } // TODO use subsystem logger for the exception. throw ConnectorLogger.ROOT_LOGGER.invalidCallbackSecurityDomain(); }
/** * Returns the {@link javax.ejb.Timer} corresponding to this timer handle * <p/> * {@inheritDoc} */ public Timer getTimer() throws IllegalStateException, EJBException { if (service == null) { // get hold of the timer service through the use of timed object id service = (TimerServiceImpl) currentServiceContainer().getRequiredService(ServiceName.parse(serviceName)).getValue(); if (service == null) { throw EjbLogger.EJB3_TIMER_LOGGER.timerServiceWithIdNotRegistered(timedObjectId); } } final TimerImpl timer = this.service.getTimer(this); if (timer == null || !timer.isActive()) { throw EjbLogger.EJB3_TIMER_LOGGER.timerHandleIsNotActive(this); } return timer; }
@SuppressWarnings("unchecked") protected ServiceController<ProcessEngine> getProcessEngineServiceController(ServiceName processEngineServiceName) { ServiceController<ProcessEngine> serviceController = (ServiceController<ProcessEngine>) serviceContainer.getRequiredService(processEngineServiceName); return serviceController; }
@SuppressWarnings("unchecked") protected ServiceController<ProcessEngine> getProcessEngineServiceController(ServiceName processEngineServiceName) { ServiceController<ProcessEngine> serviceController = (ServiceController<ProcessEngine>) serviceContainer.getRequiredService(processEngineServiceName); return serviceController; }
@SuppressWarnings("unchecked") @Override public EJBObject getEJBObject(final InterceptorContext ctx) throws IllegalStateException { if (getEjbObjectViewServiceName() == null) { throw EjbLogger.ROOT_LOGGER.beanComponentMissingEjbObject(getComponentName(), "EJBObject"); } final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(getEjbObjectViewServiceName()); final ComponentView view = (ComponentView) serviceController.getValue(); final String locatorAppName = getEarApplicationName() == null ? "" : getEarApplicationName(); if(WildFlySecurityManager.isChecking()) { //need to use doPrivileged rather than doUnchecked, as this can run user code in the proxy constructor return AccessController.doPrivileged(new PrivilegedAction<EJBObject>() { @Override public EJBObject run() { return EJBClient.createProxy(new StatefulEJBLocator<EJBObject>((Class<EJBObject>) view.getViewClass(), locatorAppName, getModuleName(), getComponentName(), getDistinctName(), getSessionIdOf(ctx), getCache().getStrictAffinity())); } }); } else { return EJBClient.createProxy(new StatefulEJBLocator<EJBObject>((Class<EJBObject>) view.getViewClass(), locatorAppName, getModuleName(), getComponentName(), getDistinctName(), getSessionIdOf(ctx), this.getCache().getStrictAffinity())); } }
@SuppressWarnings("unchecked") private ProcessApplicationDeploymentService getDeploymentService(StartContext context, ServiceName deploymentServiceName) { final ServiceContainer serviceContainer = context.getController().getServiceContainer(); ServiceController<ProcessApplicationDeploymentService> deploymentService = (ServiceController<ProcessApplicationDeploymentService>) serviceContainer.getRequiredService(deploymentServiceName); return deploymentService.getValue(); }