axisconfiguration.java
来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 1,099 行 · 第 1/3 页
JAVA
1,099 行
AxisService axisService = (AxisService) allServices.get(name);
if (axisService != null) {
if (axisService.isActive()) {
return axisService;
} else {
throw new AxisFault(Messages
.getMessage("serviceinactive", name));
}
} else {
axisService = (AxisService) allEndpoints.get(name);
if (axisService != null) {
if (axisService.isActive()) {
return axisService;
} else {
throw new AxisFault(Messages
.getMessage("serviceinactive", name));
}
}
}
return null;
}
/**
* Service can start and stop, once stopped it cannot be accessed, so we
* need a way to get the service even if service is not active.
*
* @return AxisService
*/
public AxisService getServiceForActivation(String serviceName) {
AxisService axisService = (AxisService) allServices.get(serviceName);
if (axisService != null) {
return axisService;
} else {
return null;
}
}
// The class loader that becomes the parent of all the services
public ClassLoader getServiceClassLoader() {
return this.serviceClassLoader;
}
public AxisServiceGroup getServiceGroup(String serviceNameAndGroupString) {
// return (AxisServiceGroup)
// serviceGroups.get(serviceNameAndGroupString);
return (AxisServiceGroup) getChild(serviceNameAndGroupString);
}
public Iterator getServiceGroups() {
// return serviceGroups.values().iterator();
return getChildren();
}
// To get all the services in the system
public HashMap getServices() {
return allServices;
}
// The class loader which become the top most parent of all the modules and
// services
public ClassLoader getSystemClassLoader() {
return this.systemClassLoader;
}
public TransportInDescription getTransportIn(String name) {
return (TransportInDescription) transportsIn.get(name);
}
public TransportOutDescription getTransportOut(String name) {
return (TransportOutDescription) transportsOut.get(name);
}
public HashMap getTransportsIn() {
return transportsIn;
}
public HashMap getTransportsOut() {
return transportsOut;
}
public boolean isEngaged(String moduleId) {
AxisModule module = getModule(moduleId);
if (module == null) {
return false;
}
boolean isEngaged = super.isEngaged(module);
if (!isEngaged) {
AxisModule defaultModule = getDefaultModule(moduleId);
isEngaged = engagedModules != null && engagedModules.values().contains(defaultModule);
}
return isEngaged;
}
public boolean isEngaged(AxisModule axisModule) {
boolean isEngaged = super.isEngaged(axisModule);
if (!isEngaged) {
isEngaged = engagedModules != null &&
engagedModules.values().contains(axisModule);
}
return isEngaged;
}
public void setGlobalOutPhase(ArrayList outPhases) {
this.outPhases = outPhases;
}
/**
* @param list
*/
public void setInFaultPhases(ArrayList list) {
inFaultPhases = list;
}
public void setInPhasesUptoAndIncludingPostDispatch(
ArrayList inPhasesUptoAndIncludingPostDispatch) {
this.inPhasesUptoAndIncludingPostDispatch = inPhasesUptoAndIncludingPostDispatch;
}
public void setModuleClassLoader(ClassLoader classLoader) {
this.moduleClassLoader = classLoader;
}
/**
* @param list
*/
public void setOutFaultPhases(ArrayList list) {
outFaultPhases = list;
}
public void setPhasesInfo(PhasesInfo phasesInfo) {
this.phasesinfo = phasesInfo;
}
public void setRepository(URL axis2Repository) {
this.axis2Repository = axis2Repository;
}
public void setServiceClassLoader(ClassLoader classLoader) {
this.serviceClassLoader = classLoader;
}
public void setSystemClassLoader(ClassLoader classLoader) {
this.systemClassLoader = classLoader;
}
/**
* Adds a default module version, which can be done either programmatically
* or by using axis2.xml. The default module version is important if user
* asks to engage a module without given version ID, in which case,
* the default version is engaged.
*
* @param moduleName
* @param moduleVersion
*/
public void addDefaultModuleVersion(String moduleName, String moduleVersion) {
if (nameToversionMap.get(moduleName) == null) {
nameToversionMap.put(moduleName, moduleVersion);
}
}
public String getDefaultModuleVersion(String moduleName) {
return (String) nameToversionMap.get(moduleName);
}
public AxisModule getDefaultModule(String moduleName) {
String defaultModuleVersion = getDefaultModuleVersion(moduleName);
if (defaultModuleVersion == null) {
return (AxisModule) allModules.get(moduleName);
} else {
return (AxisModule) allModules.get(moduleName + "-" + defaultModuleVersion);
}
}
public ClusterManager getClusterManager() {
return clusterManager;
}
public void setClusterManager(ClusterManager clusterManager) {
this.clusterManager = clusterManager;
}
public Object getKey() {
return toString();
}
public void stopService(String serviceName) throws AxisFault {
AxisService service = (AxisService) allServices.get(serviceName);
if (service == null) {
throw new AxisFault(Messages.getMessage("servicenamenotvalid",
serviceName));
}
service.setActive(false);
notifyObservers(AxisEvent.SERVICE_STOP, service);
}
public void startService(String serviceName) throws AxisFault {
AxisService service = (AxisService) allServices.get(serviceName);
if (service == null) {
throw new AxisFault(Messages.getMessage("servicenamenotvalid",
serviceName));
}
service.setActive(true);
notifyObservers(AxisEvent.SERVICE_START, service);
}
public List getModulesForPolicyNamesapce(String namesapce) {
return (List) policySupportedModules.get(namesapce);
}
public void registerModulePolicySupport(AxisModule axisModule) {
String[] namespaces = axisModule.getSupportedPolicyNamespaces();
if (namespaces == null) {
return;
}
List modulesList;
for (int i = 0; i < namespaces.length; i++) {
modulesList = (List) policySupportedModules.get(namespaces[i]);
if (modulesList != null) {
modulesList.add(axisModule);
} else {
modulesList = new ArrayList();
modulesList.add(axisModule);
policySupportedModules.put(namespaces[i], modulesList);
}
}
}
public void registerLocalPolicyAssertions(AxisModule axisModule) {
QName[] localPolicyAssertions = axisModule.getLocalPolicyAssertions();
if (localPolicyAssertions == null) {
return;
}
for (int i = 0; i < localPolicyAssertions.length; i++) {
addLocalPolicyAssertion(localPolicyAssertions[i]);
}
}
public ArrayList getObserversList() {
return observersList;
}
public boolean isStart() {
return start;
}
public void setStart(boolean start) {
this.start = start;
}
/**
* getTargetResolverChain returns an instance of
* TargetResolver which iterates over the registered
* TargetResolvers, calling each one in turn when
* resolveTarget is called.
*/
public TargetResolver getTargetResolverChain() {
if (targetResolvers.isEmpty()) {
return null;
}
return new TargetResolver() {
public void resolveTarget(MessageContext messageContext) {
Iterator iter = targetResolvers.iterator();
while (iter.hasNext()) {
TargetResolver tr = (TargetResolver) iter.next();
tr.resolveTarget(messageContext);
}
}
};
}
public void addTargetResolver(TargetResolver tr) {
targetResolvers.add(tr);
}
public void addLocalPolicyAssertion(QName name) {
this.localPolicyAssertions.add(name);
}
public List getLocalPolicyAssertions() {
return this.localPolicyAssertions;
}
public void removeLocalPolicyAssertion(QName name) {
this.localPolicyAssertions.remove(name);
}
public boolean isAssertionLocal(QName name) {
return this.localPolicyAssertions.contains(name);
}
/**
* Allows to define/configure Data Locator for specified dialect at Axis 2 Configuration.
*
* @param dialect- an absolute URI represents the format and version of data
* @param classname - class name of the Data Locator configured to support retrieval
* for the specified dialect.
*/
public void addDataLocatorClassNames(String dialect, String classname) {
dataLocatorClassNames.put(dialect, classname);
}
/**
* For internal used only! To store instance of DataLocator when it is first loaded. This allows to
* reuse of the DataLocator after it is initially loaded.
*
* @param dialect- an absolute URI represents the format and version of data
* @param dataLocator - specified an DataLocator instance to support retrieval
* of the specified dialect.
*/
public void addDataLocator(String dialect, AxisDataLocator dataLocator) {
dataLocators.put(dialect, dataLocator);
}
/**
* Return DataLocator instance for specified dialect.
*/
public AxisDataLocator getDataLocator(String dialect) {
return (AxisDataLocator) dataLocators.get(dialect);
}
/**
* Return classname of DataLocator configured for specified dialect.
*/
public String getDataLocatorClassName(String dialect) {
return (String) dataLocatorClassNames.get(dialect);
}
/**
* Checks whether the system pre-defined phases
* for all the flows, have been changed. If they have been changed, throws a DeploymentException.
*
* @throws org.apache.axis2.deployment.DeploymentException
*
*/
public void validateSystemPredefinedPhases() throws DeploymentException {
PhasesInfo phasesInfo = getPhasesInfo();
setInPhasesUptoAndIncludingPostDispatch(phasesInfo.getGlobalInflow());
setInFaultPhases(phasesInfo.getGlobalInFaultPhases());
setGlobalOutPhase(phasesInfo.getGlobalOutPhaseList());
setOutFaultPhases(phasesInfo.getOUT_FaultPhases());
}
public AxisConfigurator getConfigurator() {
return configurator;
}
public void setConfigurator(AxisConfigurator configurator) {
this.configurator = configurator;
}
public void cleanup() {
if (configurator != null) {
configurator.cleanup();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?