private void checkWellFormed(final URL url) throws ParserConfigurationException, SAXException, IOException { final String parserFactoryClass = SystemInstance.get().getProperty("tribe.governance.sax.parser.factory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"); final SAXParserFactory factory = SAXParserFactory.newInstance(parserFactoryClass, Thread.currentThread().getContextClassLoader()); final SAXParser saxParser = factory.newSAXParser(); saxParser.parse(url.openStream(), new DefaultHandler()); }
public static Level level() { final String propLevel = SystemInstance.get().getProperty(OPENEJB_LOG_LEVEL, DEFAULT_LOG_LEVEL).toUpperCase(); try { return (Level) Level.class.getDeclaredField(propLevel).get(null); } catch (final IllegalAccessException e) { return Level.INFO; } catch (final NoSuchFieldException e) { return Level.INFO; } } }
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); } }
@Inject public Deployables(final Strings strings) { this.strings = strings; this.pattern = SystemInstance.get().getProperty(PATTERN_KEY); }
private boolean isDataSourcePropertiesConfigured(final Properties properties) { return "true".equals(SystemInstance.get().getProperty("openejb.guess.resource-local-datasource-properties-configured", "true")) && (properties.containsKey("javax.persistence.jdbc.driver") || properties.containsKey("javax.persistence.jdbc.url")); }
protected static String autoJaccProvider() { return SystemInstance.isInitialized() ? SystemInstance.get().getProperty(JaccProvider.class.getName(), BasicJaccProvider.class.getName()) : BasicJaccProvider.class.getName(); }
public Logger(final LogCategory category, final LogStream logStream, final String baseName) { this.category = category; this.baseName = baseName; this.logStream = ("true".equals(SystemInstance.get().getProperty("openejb.log.async", "false")) ? new LogStreamAsync(logStream) : logStream); }
protected boolean checkReadOnly() throws OperationNotSupportedException { if (readOnly) { //alignment with tomcat behavior if("true".equals(SystemInstance.get().getProperty(JNDI_EXCEPTION_ON_FAILED_WRITE,"true"))) { throw new OperationNotSupportedException(); } return true; } return false; }
public Logger(LogCategory category, LogStream logStream, String baseName) { this.category = category; this.baseName = baseName; this.logStream = ("true".equals(SystemInstance.get().getProperty("openejb.log.async", "false")) ? new LogStreamAsync(logStream) : logStream); }
private boolean isActivateCdiForEjbOnlyModules(final EjbModule ejbModule) { final String activated = ejbModule.getProperties().getProperty("openejb.cdi.activated"); final String globalConfig = SystemInstance.get().getProperty("openejb.cdi.activated-on-ejb"); // spec should be true but mem + bck compat return (globalConfig == null || Boolean.parseBoolean(globalConfig)) && ((activated == null && hasAtInject(ejbModule)) || (activated != null && Boolean.parseBoolean(activated))); }
public static AbstractSecurityService create() { return !SystemInstance.get().getProperty("openejb.loader", "no").toLowerCase(Locale.ENGLISH).contains("tom") ? new SecurityServiceImpl() : new TomcatSecurityService(); } }
public Logger(final LogCategory category, final LogStream logStream, final String baseName) { this.category = category; this.baseName = baseName; this.logStream = // tomcat is already async so abuse of it ("true".equals(SystemInstance.get().getProperty("openejb.log.async", "true")) && JavaSecurityManagers.getSystemProperty("catalina.home") == null) ? new LogStreamAsync(logStream) : logStream; }
@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);
private Ansi.Color color(final String lvl, final String aDefault) { try { return Ansi.Color.valueOf(SystemInstance.get().getProperty(OPENEJB_LOG_COLOR_PREFIX + lvl, aDefault)); } catch (final IllegalArgumentException iae) { return Ansi.Color.valueOf(aDefault); } }
private Ansi.Color color(final String lvl, final String aDefault) { try { return Ansi.Color.valueOf(SystemInstance.get().getProperty(OPENEJB_LOG_COLOR_PREFIX + lvl, aDefault)); } catch (final IllegalArgumentException iae) { return Ansi.Color.valueOf(aDefault); } }
private String getProperty(EjbModule ejbModule, String key, String defaultValue) { OpenejbJar openejbJar = ejbModule.getOpenejbJar(); String value = SystemInstance.get().getProperty(key, defaultValue); if (openejbJar != null && openejbJar.getProperties() != null){ value = openejbJar.getProperties().getProperty(key, value); } return value; }
public void destroy(@Observes final AssemblerBeforeApplicationDestroyed ignored) { final SystemInstance systemInstance = SystemInstance.get(); final Bus bus = getBus(); // avoid to leak, we can enhance it to remove endpoints by app but not sure it does worth the effort // alternative can be a bus per app but would enforce us to change some deeper part of our config/design if ("true".equalsIgnoreCase(systemInstance.getProperty("openejb.cxf.monitoring.jmx.clear-on-undeploy", "true"))) { final CounterRepository repo = bus.getExtension(CounterRepository.class); if (repo != null) { repo.getCounters().clear(); } } } }
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 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(); }