DefaultAxisServerFactorypublic class DefaultAxisServerFactory extends Object implements AxisServerFactoryHelper class for obtaining AxisServers. Default implementation. |
Fields Summary |
---|
protected static Log | log |
Methods Summary |
---|
private static AxisServer | createServer(java.util.Map environment)Do the actual work of creating a new AxisServer, using the
configuration, or using the default constructor if null is passed.
EngineConfiguration config = getEngineConfiguration(environment);
// Return new AxisServer using the appropriate config
return (config == null) ? new AxisServer() : new AxisServer(config);
| private static org.apache.axis.EngineConfiguration | getEngineConfiguration(java.util.Map environment)Look for EngineConfiguration, it is first of:
a) EngineConfiguration instance, keyed to
EngineConfiguration.PROPERTY_NAME in 'environment', or
b) EngineConfiguration class name, keyed to
AxisEngine.PROP_DEFAULT_CONFIG_CLASS in AxisProperties.
Class is instantiated if found.
log.debug("Enter: DefaultAxisServerFactory::getEngineConfiguration");
EngineConfiguration config = null;
if (environment != null) {
try {
config = (EngineConfiguration)environment.get(EngineConfiguration.PROPERTY_NAME);
} catch (ClassCastException e) {
log.warn(Messages.getMessage("engineConfigWrongClass00"), e);
// Fall through
}
}
if (config == null) {
// A default engine configuration class may be set in a system
// property. If so, try creating an engine configuration.
String configClass = AxisProperties.getProperty(AxisEngine.PROP_DEFAULT_CONFIG_CLASS);
if (configClass != null) {
try {
// Got one - so try to make it (which means it had better have
// a default constructor - may make it possible later to pass
// in some kind of environmental parameters...)
Class cls = ClassUtils.forName(configClass);
config = (EngineConfiguration)cls.newInstance();
} catch (ClassNotFoundException e) {
log.warn(Messages.getMessage("engineConfigNoClass00", configClass), e);
// Fall through
} catch (InstantiationException e) {
log.warn(Messages.getMessage("engineConfigNoInstance00", configClass), e);
// Fall through
} catch (IllegalAccessException e) {
log.warn(Messages.getMessage("engineConfigIllegalAccess00", configClass), e);
// Fall through
} catch (ClassCastException e) {
log.warn(Messages.getMessage("engineConfigWrongClass01", configClass), e);
// Fall through
}
}
}
log.debug("Exit: DefaultAxisServerFactory::getEngineConfiguration");
return config;
| public AxisServer | getServer(java.util.Map environment)Get an AxisServer.
Factory obtains EngineConfiguration as first found of the following:
a) EngineConfiguration instance, keyed to
EngineConfiguration.PROPERTY_NAME in 'environment', or
b) EngineConfiguration class name, keyed to
AxisEngine.PROP_DEFAULT_CONFIG_CLASS in AxisProperties.
Class is instantiated if found.
If an EngineConfiguration cannot be located, the default
AxisServer constructor is used.
The AxisServer's option AxisEngine.PROP_ATTACHMENT_DIR is set to
the (first found) value of either AxisEngine.ENV_ATTACHMENT_DIR
or AxisEngine.ENV_SERVLET_REALPATH.
log.debug("Enter: DefaultAxisServerFactory::getServer");
AxisServer ret = createServer(environment);
if (ret != null) {
if (environment != null) {
ret.setOptionDefault(AxisEngine.PROP_ATTACHMENT_DIR,
(String)environment.get(AxisEngine.ENV_ATTACHMENT_DIR));
ret.setOptionDefault(AxisEngine.PROP_ATTACHMENT_DIR,
(String)environment.get(AxisEngine.ENV_SERVLET_REALPATH));
}
String attachmentsdir = (String)ret.getOption(AxisEngine.PROP_ATTACHMENT_DIR);
if (attachmentsdir != null) {
File attdirFile = new File(attachmentsdir);
if (!attdirFile.isDirectory()) {
attdirFile.mkdirs();
}
}
}
log.debug("Exit: DefaultAxisServerFactory::getServer");
return ret;
|
|