public TransactionSynchronizationRegistry getRegistry() { final SystemInstance system = SystemInstance.get(); if (system != this.system) { this.registry = system.getComponent(TransactionSynchronizationRegistry.class); this.system = system; } return registry; }
public static Executor getDefaultExecutor() { Executor executor = SystemInstance.get().getComponent(Executor.class); if (executor == null) { executor = Executors.newFixedThreadPool(10); SystemInstance.get().setComponent(Executor.class, executor); } return executor; }
private void customizeProperties(final Map<String, Object> properties) { final String pool = SystemInstance.get().getProperty(OPENJPA_ENTITY_MANAGER_FACTORY_POOL); if (pool != null) { properties.put(OPENJPA_ENTITY_MANAGER_FACTORY_POOL, pool); } }
private void setDefaultProperty(String key, String value) { SystemInstance systemInstance = SystemInstance.get(); String format = systemInstance.getProperty(key); if (format == null){ systemInstance.setProperty(key, value); } }
public String toScreen() { final String str = "both files " + file1 + '\'' + " and " + file2 + '\''; if (SystemInstance.get().getOptions().get(OPENEJB_CHECK_CLASSLOADER_VERBOSE, false)) { return str + " contains files=" + files; } return str; } }
public DiscoveryRegistry(DiscoveryAgent agent) { SystemInstance.get().setComponent(DiscoveryRegistry.class, this); SystemInstance.get().setComponent(DiscoveryAgent.class, this); addDiscoveryAgent(agent); }
@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 void setupTribestreamProvider(@Observes final AssemblerCreated init) { final SystemInstance si = SystemInstance.get(); final String value = si.getProperty("openejb.provider.default", "com.tomitribe.tomee"); si.setProperty("openejb.provider.default", value); final CheckService checkService = new CheckService(); checkService.start(); SystemInstance.get().addObserver(checkService); SystemInstance.get().setComponent(CheckService.class, checkService); registerDataSourceCreators(); setDefaultCreator(); }
public static ClassLoader get() { final ParentClassLoaderFinder parentFinder = SystemInstance.isInitialized() ? SystemInstance.get().getComponent(ParentClassLoaderFinder.class) : null; if (parentFinder != null) { return parentFinder.getParentClassLoader(FALLBACK); } return FALLBACK; } }
public static synchronized void destroy() { final Assembler assembler = SystemInstance.get().getComponent(Assembler.class); if (assembler != null) { assembler.destroy(); } else { SystemInstance.reset(); } ConnectionFactoryWrapper.closeConnections(); instance = null; }
@Override public void start() throws LifecycleException { try { this.container.start(); SystemInstance.get().setComponent(AdditionalBeanDiscoverer.class, new TestClassDiscoverer()); // this property is not mandatory by default but depending the protocol it can be relevant so adding it by default SystemInstance.get().setProperty("org.apache.openejb.servlet.filters", ArquillianFilterRunner.class.getName() + "=/ArquillianServletRunner"); } catch (final Exception e) { throw new LifecycleException("Something went wrong", e); } }
@Override public String updatedUrl(final String dataSourceUrl) { System.setProperty("derby.system.home" , SystemInstance.get().getProperty("derby.system.home", SystemInstance.get().getBase().getDirectory().getAbsolutePath())); return dataSourceUrl; }
@Override public String lookup(final String key) { if (headerLocation != null) { return headerLocation; } final String s = SystemInstance.get().getProperty("tribe.server.location", SystemInstance.get().getOptions().get("server.location", (String) null)); if (s != null && !s.trim().isEmpty()) { return s; } // default return the current server location return defaultLocation; } }).replace(template);
protected static String autoJaccProvider() { return SystemInstance.isInitialized() ? SystemInstance.get().getProperty(JaccProvider.class.getName(), BasicJaccProvider.class.getName()) : BasicJaccProvider.class.getName(); }
private static String getAltDD() { final String property = "openejb.altdd.prefix"; if (SystemInstance.isInitialized()) { return SystemInstance.get().getOptions().get(property, (String) null); } return JavaSecurityManagers.getSystemProperty(property); }
public void destroy(@Observes final AssemblerDestroyed ignored) { final SystemInstance systemInstance = SystemInstance.get(); final Bus bus = getBus(); if ("true".equalsIgnoreCase(systemInstance.getProperty("openejb.cxf.jmx", "true"))) { final InstrumentationManager mgr = bus.getExtension(InstrumentationManager.class); if (InstrumentationManagerImpl.class.isInstance(mgr)) { mgr.shutdown(); } } systemInstance.removeObserver(this); }
public static void loadPropertiesDeclaredConfiguration(final Openejb openejb) { final Properties sysProps = new Properties(System.getProperties()); sysProps.putAll(SystemInstance.get().getProperties()); fillOpenEjb(openejb, sysProps); }
public void init(Properties properties) throws Exception { if (openejb != null) return; openejb = new OpenEJBInstance(); if (openejb.isInitialized()) return; bootedOpenEJB = true; SystemInstance.init(properties); OptionsLog.install(); SystemInstance.get().setProperty("openejb.embedded", "true"); openejb.init(properties); }
public static void addExtensions(final ClassLoader loader, final Collection<String> classes) { for (final String clazz : classes) { try { final Object object = loader.loadClass(clazz).newInstance(); SystemInstance.get().addObserver(object); } catch (final Throwable t) { LOGGER.error("Extension construction failed" + clazz, t); } } }