private String[] getContextResourcePatterns() { return new String[] { ChildApplicationContextFactory.CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + ChildApplicationContextFactory.CONTEXT_SUFFIX, ChildApplicationContextFactory.CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + ChildApplicationContextFactory.ENTERPRISE_CONTEXT_SUFFIX, ChildApplicationContextFactory.EXTENSION_CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + '/' + ChildApplicationContextFactory.this.getId().get( ChildApplicationContextFactory.this.getId().size() - 1) + ChildApplicationContextFactory.CONTEXT_SUFFIX }; }
public void stop() { if (this.applicationContext != null) { ChildApplicationContextFactory.logger .info("Stopping '" + getCategory() + "' subsystem, ID: " + getId()); try { this.applicationContext.close(); } catch (Exception e) { ChildApplicationContextFactory.logger.error(e); // Continue anyway. Perhaps it didn't start properly } this.applicationContext = null; ChildApplicationContextFactory.logger.info("Stopped '" + getCategory() + "' subsystem, ID: " + getId()); } }
public void stop() { if (this.applicationContext != null) { ChildApplicationContextFactory.logger .info("Stopping '" + getCategory() + "' subsystem, ID: " + getId()); try { this.applicationContext.close(); } catch (Exception e) { ChildApplicationContextFactory.logger.error(e); // Continue anyway. Perhaps it didn't start properly } this.applicationContext = null; ChildApplicationContextFactory.logger.info("Stopped '" + getCategory() + "' subsystem, ID: " + getId()); } }
private String[] getContextResourcePatterns() { return new String[] { ChildApplicationContextFactory.CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + ChildApplicationContextFactory.CONTEXT_SUFFIX, ChildApplicationContextFactory.CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + ChildApplicationContextFactory.ENTERPRISE_CONTEXT_SUFFIX, ChildApplicationContextFactory.EXTENSION_CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + '/' + ChildApplicationContextFactory.this.getId().get( ChildApplicationContextFactory.this.getId().size() - 1) + ChildApplicationContextFactory.CONTEXT_SUFFIX }; }
.info("Starting '" + getCategory() + "' subsystem, ID: " + getId()); ClassPathXmlApplicationContext applicationContext = ChildApplicationContextFactory.this.new ChildApplicationContext( prop, this.compositeProperties); ChildApplicationContextFactory.logger.info("Startup of '" + getCategory() + "' subsystem, ID: " + getId() + " complete"); ChildApplicationContextFactory.logger.warn("Startup of '" + getCategory() + "' subsystem, ID: " + getId() + " failed", e); this.lastStartupError = e;
.info("Starting '" + getCategory() + "' subsystem, ID: " + getId()); ClassPathXmlApplicationContext applicationContext = ChildApplicationContextFactory.this.new ChildApplicationContext( prop, this.compositeProperties); ChildApplicationContextFactory.logger.info("Startup of '" + getCategory() + "' subsystem, ID: " + getId() + " complete"); ChildApplicationContextFactory.logger.warn("Startup of '" + getCategory() + "' subsystem, ID: " + getId() + " failed", e); this.lastStartupError = e;
getPropertyDefaults(), getCategory(), type, childPath);
getPropertyDefaults(), getCategory(), type, childPath);
@Override public void afterPropertiesSet() throws Exception { List<String> idList = getInstancePath(); if (idList.isEmpty()) { throw new IllegalStateException("Invalid instance path"); } if (getTypeName() == null) { setTypeName(idList.get(0)); } super.afterPropertiesSet(); // Validate that context files exist for this path if (new ResourceFinder(getParent()).getResources(getContextResourcePatterns()).length == 0) { throw new IllegalStateException("Invalid type " + getTypeName() + " specified for "+ getCategory() + " subsystem. No context file found"); } }
@Override public void afterPropertiesSet() throws Exception { List<String> idList = getInstancePath(); if (idList.isEmpty()) { throw new IllegalStateException("Invalid instance path"); } if (getTypeName() == null) { setTypeName(idList.get(0)); } super.afterPropertiesSet(); // Validate that context files exist for this path if (new ResourceFinder(getParent()).getResources(getContextResourcePatterns()).length == 0) { throw new IllegalStateException("Invalid type " + getTypeName() + " specified for "+ getCategory() + " subsystem. No context file found"); } }
@Override protected void applyDefaultOverrides(PropertyBackedBeanState state) throws IOException { // Let the superclass propagate default settings from the global properties and register us super.applyDefaultOverrides(state); List<String> idList = getId(); // Apply any property overrides from the extension classpath and also allow system properties and JNDI to // override. We use the type name and last component of the ID in the path JndiPropertiesFactoryBean overrideFactory = new JndiPropertiesFactoryBean(); overrideFactory.setPropertiesPersister(getPersister()); overrideFactory.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); overrideFactory.setLocations(getParent().getResources( ChildApplicationContextFactory.EXTENSION_CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + '/' + idList.get(idList.size() - 1) + ChildApplicationContextFactory.PROPERTIES_SUFFIX)); overrideFactory.setProperties(((ApplicationContextState) state).properties); overrideFactory.afterPropertiesSet(); ((ApplicationContextState) state).properties = (Properties) overrideFactory.getObject(); }
@Override protected void applyDefaultOverrides(PropertyBackedBeanState state) throws IOException { // Let the superclass propagate default settings from the global properties and register us super.applyDefaultOverrides(state); List<String> idList = getId(); // Apply any property overrides from the extension classpath and also allow system properties and JNDI to // override. We use the type name and last component of the ID in the path JndiPropertiesFactoryBean overrideFactory = new JndiPropertiesFactoryBean(); overrideFactory.setPropertiesPersister(getPersister()); overrideFactory.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); overrideFactory.setLocations(getParent().getResources( ChildApplicationContextFactory.EXTENSION_CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + '/' + idList.get(idList.size() - 1) + ChildApplicationContextFactory.PROPERTIES_SUFFIX)); overrideFactory.setProperties(((ApplicationContextState) state).properties); overrideFactory.afterPropertiesSet(); ((ApplicationContextState) state).properties = (Properties) overrideFactory.getObject(); }
/** * Instantiates a new application context state. * * @throws IOException * Signals that an I/O exception has occurred. */ protected ApplicationContextState(boolean allowInitAccess ) throws IOException { this.allowInitAccess = allowInitAccess; // Load the property defaults PropertiesFactoryBean factory = new PropertiesFactoryBean(); factory.setPropertiesPersister(getPersister()); factory.setLocations(getParent().getResources( ChildApplicationContextFactory.CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + ChildApplicationContextFactory.PROPERTIES_SUFFIX)); factory.afterPropertiesSet(); this.properties = (Properties) factory.getObject(); }
/** * Instantiates a new application context state. * * @throws IOException * Signals that an I/O exception has occurred. */ protected ApplicationContextState(boolean allowInitAccess ) throws IOException { this.allowInitAccess = allowInitAccess; // Load the property defaults PropertiesFactoryBean factory = new PropertiesFactoryBean(); factory.setPropertiesPersister(getPersister()); factory.setLocations(getParent().getResources( ChildApplicationContextFactory.CLASSPATH_PREFIX + getCategory() + '/' + getTypeName() + ChildApplicationContextFactory.PROPERTIES_SUFFIX)); factory.afterPropertiesSet(); this.properties = (Properties) factory.getObject(); }