private static void list(final Collection<String> list, final String key) { list.clear(); final String s = SystemInstance.get().getOptions().get(key, (String) null); if (s != null && !s.trim().isEmpty()) { list.addAll(Arrays.asList(s.trim().split(","))); } }
public TempClassLoader(final ClassLoader parent) { super(new URL[0], parent); this.skip = SystemInstance.get().getOptions().getAll("openejb.tempclassloader.skip", Skip.NONE); this.system = ClassLoader.getSystemClassLoader(); this.embedded = this.getClass().getClassLoader() == this.system; }
public EventTempClassLoader(final ClassLoader parent) { super(new URL[0], parent); this.skip = SystemInstance.get().getOptions().getAll("openejb.tempclassloader.skip", Skip.NONE); this.system = ClassLoader.getSystemClassLoader(); this.embedded = this.getClass().getClassLoader() == this.system; }
public static PermissionCollection getPermissionCollection() { try { return (PermissionCollection) DelegatePermissionCollection.class.getClassLoader() .loadClass( SystemInstance.get().getOptions().get(PERMISSION_COLLECTION_CLASS, FastPermissionCollection.class.getName())) .newInstance(); } catch (final Exception cnfe) { // return new Permissions(); // the jdk implementation, it seems slow at least for startup up return new FastPermissionCollection(); } }
private void doShutdownExecutor(final boolean waitJobs) { final ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor; tpe.shutdown(); if (waitJobs) { final int timeout = SystemInstance.get().getOptions().get(OPENEJB_EJB_TIMER_POOL_AWAIT_SECONDS, 5); try { tpe.awaitTermination(timeout, TimeUnit.SECONDS); } catch (final InterruptedException e) { logger.error(e.getMessage(), e); } } }
public Log4jLogStreamFactory() { try { final boolean externalLogging = SystemInstance.get().getOptions().get("openejb.logger.external", false); if (!externalLogging) { configureInternal(); } } catch (final Exception e) { // The fall back here is that if log4j.configuration system property is set, then that configuration file will be used. e.printStackTrace(); } System.setProperty("openwebbeans.logging.factory", "org.apache.openejb.cdi.logging.Log4jLoggerFactory"); }
public static String routerConfigurationName() { final String conf = SystemInstance.get().getOptions().get(DeploymentLoader.OPENEJB_ALTDD_PREFIX, (String) null); if (conf == null) { return ROUTER_CONF; } else { return conf + "." + ROUTER_CONF; } }
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; } }
@Override public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) throws SAXException { // by default don't care about root tag if (!APPLICATION_ALIASES.contains(localName.toLowerCase()) && SystemInstance.get().getOptions().get("openejb.configuration.strict-tags", false)) { throw new IllegalStateException("Unsupported Element: " + localName); } push(new Root()); } }
@Override public int getMajorVersion() { return SystemInstance.get().getOptions().get(prefix + "." + OPENEJB_WEB_XML_MAJOR_VERSION_PROPERTY, SystemInstance.get().getOptions().get(OPENEJB_WEB_XML_MAJOR_VERSION_PROPERTY, super.getMajorVersion())); } }
public AutoDeployer(final ConfigurationFactory factory, final List<Deployments> deployments) { final Options options = SystemInstance.get().getOptions(); final Duration interval = options.get("openejb.autodeploy.interval", new Duration(2, TimeUnit.SECONDS)); if (interval.getUnit() == null) { interval.setUnit(TimeUnit.SECONDS); } this.factory = factory; this.deployments.addAll(deployments); this.pollIntervalMillis = interval.getUnit().toMillis(interval.getTime()); this.timer = new Timer(this.getClass().getSimpleName(), true); }
private static boolean shouldAutoDeploy() { final Options options = SystemInstance.get().getOptions(); final boolean b = options.get(ConfigurationFactory.OFFLINE_PROPERTY, false); return options.get("tomee.autoconfig", !b); }
public boolean start() { if (!connect()) { forkServerProcess(); final int port = SystemInstance.get().getOptions().get("ejbd.port", 4201); return Connect.connect(10, "localhost", port); } else { System.out.println(":: server already started ::"); return true; } }
public void init(Properties props) throws OpenEJBException { this.props = new Properties(props); Options options = new Options(props, SystemInstance.get().getOptions()); String className = options.get("openejb.configurator", "org.apache.openejb.config.ConfigurationFactory"); configFactory = (OpenEjbConfigurationFactory) toolkit.newInstance(className); configFactory.init(props); }
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); }
private String getProperty(final String key, final String defaultValue) { String value = SystemInstance.get().getOptions().get(key, defaultValue); final DeploymentModule module = getModule(); if (module instanceof EjbModule) { final EjbModule ejbModule = (EjbModule) module; final OpenejbJar openejbJar = ejbModule.getOpenejbJar(); if (openejbJar != null && openejbJar.getProperties() != null) { value = openejbJar.getProperties().getProperty(key, value); } } return value; }
private String getProperty(final String key, final String defaultValue) { String value = SystemInstance.get().getOptions().get(key, defaultValue); final DeploymentModule module = getModule(); if (module instanceof EjbModule) { final EjbModule ejbModule = (EjbModule) module; final OpenejbJar openejbJar = ejbModule.getOpenejbJar(); if (openejbJar != null && openejbJar.getProperties() != null) { value = openejbJar.getProperties().getProperty(key, value); } } return value; }
public ClasspathSearcher() { final Options options = SystemInstance.get().getOptions(); include = options.get(CLASSPATH_INCLUDE, ".*"); exclude = options.get(CLASSPATH_EXCLUDE, ""); filterSystemApps = options.get(CLASSPATH_FILTER_SYSTEMAPPS, true); requireDescriptors = options.getAll(CLASSPATH_REQUIRE_DESCRIPTOR, RequireDescriptors.CLIENT); filterDescriptors = options.get(CLASSPATH_FILTER_DESCRIPTORS, false); }
public AppModule deploy(final AppModule appModule) throws OpenEJBException { final AppValidator validator; if (!SystemInstance.get().getOptions().get(OPENEJB_CHECK_CLASSLOADER, false)) { validator = new AppValidator(); } else { validator = new AppValidator(new CheckClassLoading()); } return validator.validate(appModule); }
public AnnotationDeployer() { discoverAnnotatedBeans = new DiscoverAnnotatedBeans(); processAnnotatedBeans = new ProcessAnnotatedBeans(SystemInstance.get().getOptions().get("openejb.jaxws.add-remote", false)); builtInEnvironmentEntries = new BuiltInEnvironmentEntries(); envEntriesPropertiesDeployer = new EnvEntriesPropertiesDeployer(); mBeanDeployer = new MBeanDeployer(); mergeWebappJndiContext = new MergeWebappJndiContext(); }