public void setORBContext(ORB orb, HandleDelegate handleDelegate) { // this is only processed once, since these are global values. if (this.orb == null) { this.orb = orb; SystemInstance.get().setComponent(ORB.class, orb); SystemInstance.get().setComponent(HandleDelegate.class, handleDelegate); } }
public TreeBuilder() { // registering as singleton and ease its access if (SystemInstance.get().setComponent(TreeInfo.class, treeInfo) != null) { throw new IllegalStateException("you can't register twice TreeBuilder"); } SystemInstance.get().setComponent(TreeBuilder.class, this); }
@SuppressWarnings({"unchecked"}) private void setSystemInstanceComponent(final Class interfce, final Object service) { SystemInstance.get().setComponent(interfce, service); }
@SuppressWarnings("unchecked") private void setComponent(final Object testInstance, final Method method) throws IllegalAccessException, InvocationTargetException, InstantiationException { Object value = method.invoke(testInstance); if (value instanceof Class<?>) { value = ((Class<?>) value).newInstance(); } final Class<?> key = method.getReturnType(); if (!key.isInstance(value)) { // we can't do it in validate to avoid to instantiate the value twice throw new OpenEJBRuntimeException(value + " is not an instance of " + key.getName()); } SystemInstance.get().setComponent((Class<Object>) key, value); }
private void setComponentsUsedByCDI() { final SystemInstance systemInstance = SystemInstance.get(); if (systemInstance.getComponent(HttpServletRequest.class) == null) { systemInstance.setComponent(HttpServletRequest.class, Proxys.threadLocalProxy(HttpServletRequest.class, OpenEJBSecurityListener.requests, null)); } if (systemInstance.getComponent(HttpSession.class) == null) { systemInstance.setComponent(javax.servlet.http.HttpSession.class, Proxys.threadLocalRequestSessionProxy(OpenEJBSecurityListener.requests, null)); } if (systemInstance.getComponent(ServletContext.class) == null) { systemInstance.setComponent(ServletContext.class, Proxys.handlerProxy(servletContextHandler, ServletContext.class, CdiAppContextsService.FiredManually.class)); } }
public AbstractSecurityService(final String jaccProvider) { System.setProperty(JaccProvider.class.getName(), jaccProvider); installJacc(); ThreadContext.addThreadContextListener(this); // set the default subject and the default context updateSecurityContext(); SystemInstance.get().setComponent(BasicPolicyConfiguration.RoleResolver.class, this); }
public AbstractSecurityService(String jaccProvider) { System.setProperty(JaccProvider.class.getName(), jaccProvider); installJacc(); ThreadContext.addThreadContextListener(this); // set the default subject and the default context updateSecurityContext(); SystemInstance.get().setComponent(BasicPolicyConfiguration.RoleResolver.class, this); }
private void setConfiguration(final OpenEjbConfiguration config) { this.config = config; if (config.containerSystem == null) { config.containerSystem = new ContainerSystemInfo(); } if (config.facilities == null) { config.facilities = new FacilitiesInfo(); } SystemInstance.get().setComponent(OpenEjbConfiguration.class, this.config); }
private void setConfiguration(final OpenEjbConfiguration config) { this.config = config; if (config.containerSystem == null) { config.containerSystem = new ContainerSystemInfo(); } if (config.facilities == null) { config.facilities = new FacilitiesInfo(); } SystemInstance.get().setComponent(OpenEjbConfiguration.class, this.config); }
public static HttpListenerRegistry getHttpListenerRegistry() { SystemInstance systemInstance = SystemInstance.get(); HttpListenerRegistry registry = systemInstance.getComponent(HttpListenerRegistry.class); if (registry == null){ registry = new HttpListenerRegistry(); systemInstance.setComponent(HttpListenerRegistry.class, registry); } return registry; }
public void createTrackerService(@Observes final ObserverAdded event) { if (event.getObserver() != this) { return; } // can configure user interceptors (BeanContext) so do it before deploying anything SystemInstance.get().setComponent(TrackerService.class, trackerService); }
public void register(@Observes final WrappedComponentRegistration registration) { Object proxy = Proxy.newProxyInstance(ParentClassLoaderFinder .Helper.get(), new Class<?>[]{registration.getApi()}, new ClassLoaderAwareHandler(registration.getApi().getName() + "::Proxy", registration.getInstance(), Thread.currentThread().getContextClassLoader())); SystemInstance.get().setComponent(registration.getApi(), proxy); } }
public ORB create() { ORB orb = SystemInstance.get().getComponent(ORB.class); if (orb == null) { // todo add support for args and properties orb = ORB.init(); SystemInstance.get().setComponent(ORB.class, orb); } return orb; } }
@Override public void init(final Properties props) throws Exception { final SystemInstance system = SystemInstance.get(); TomcatRsRegistry tomcatRestHandler = (TomcatRsRegistry) system.getComponent(RsRegistry.class); if (tomcatRestHandler == null) { tomcatRestHandler = new TomcatRsRegistry(); system.setComponent(RsRegistry.class, tomcatRestHandler); } system.addObserver(this); }
public ORB create() { ORB orb = SystemInstance.get().getComponent(ORB.class); if (orb == null) { // todo add support for args and properties orb = ORB.init(); SystemInstance.get().setComponent(ORB.class, orb); } return orb; } }
@Override public void init(final Properties props) throws java.lang.Exception { super.init(props); CxfUtil.configureBus(); SaajInterceptor.registerInterceptors(); factoryByListener = "true".equalsIgnoreCase(props.getProperty("openejb.cxf.factoryByListener", "false")); transportFactory = new SoapTransportFactory(); if (SystemInstance.get().getComponent(JaxWsServiceReference.WebServiceClientCustomizer.class) == null) { SystemInstance.get().setComponent(JaxWsServiceReference.WebServiceClientCustomizer.class, new WebServiceInjectionConfigurator()); } }
public OpenEJBHttpServer(final HttpListener listener) { if (SystemInstance.get().getComponent(SessionManager.class) == null) { SystemInstance.get().setComponent(SessionManager.class, new SessionManager()); } this.listener = new OpenEJBHttpRegistry.ClassLoaderHttpListener( listener == null ? getHttpListenerRegistry() : listener, ParentClassLoaderFinder.Helper.get()); }
public static ProviderManager getManager() { final ProviderManager manager = SystemInstance.get().getComponent(ProviderManager.class); if (manager != null) { return manager; } SystemInstance.get().setComponent(ProviderManager.class, new ProviderManager(new ServiceJarXmlLoader())); return getManager(); }
public static ProviderManager getManager() { final ProviderManager manager = SystemInstance.get().getComponent(ProviderManager.class); if (manager != null) { return manager; } SystemInstance.get().setComponent(ProviderManager.class, new ProviderManager(new ServiceJarXmlLoader())); return getManager(); }
@Override public void init(final Properties props) throws java.lang.Exception { super.init(props); CxfUtil.configureBus(); SaajInterceptor.registerInterceptors(); initBusTransport(CxfUtil.getBus()); if (SystemInstance.get().getComponent(JaxWsServiceReference.WebServiceClientCustomizer.class) == null) { SystemInstance.get().setComponent(JaxWsServiceReference.WebServiceClientCustomizer.class, new WebServiceInjectionConfigurator()); } }