axisconfiguration.java
来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 1,099 行 · 第 1/3 页
JAVA
1,099 行
Iterator services = axisServiceGroup.getServices();
while (services.hasNext()) {
AxisService axisService = (AxisService) services.next();
allServices.remove(axisService.getName());
if (!axisService.isClientSide()) {
notifyObservers(AxisEvent.SERVICE_REMOVE, axisService);
}
}
removeChild(serviceGroupName);
notifyObservers(AxisEvent.SERVICE_REMOVE, axisServiceGroup);
return axisServiceGroup;
}
/**
* Method addTransportIn.
*
* @param transport
* @throws AxisFault
*/
public void addTransportIn(TransportInDescription transport) throws AxisFault {
if (transport.getReceiver() == null) {
throw new AxisFault(
"Transport Receiver can not be null for the transport "
+ transport.getName());
}
transportsIn.put(transport.getName(), transport);
}
/**
* Method addTransportOut.
*
* @param transport
* @throws AxisFault
*/
public void addTransportOut(TransportOutDescription transport)
throws AxisFault {
if (transport.getSender() == null) {
throw new AxisFault(
"Transport sender can not be null for the transport "
+ transport.getName());
}
transportsOut.put(transport.getName(), transport);
}
/**
* Engages the default module version corresponding to the given module name,
* or if the module name contains version number in it then it will engage
* the correct module. Both the below cases are valid : -
* 1. engageModule("addressing"); 2. engageModule("addressing-1.23");
*
* @param moduleref QName of module to engage
* @throws AxisFault
* @deprecated Please use the String version instead
*/
public void engageModule(QName moduleref) throws AxisFault {
engageModule(moduleref.getLocalPart());
}
/**
* Engages the default module version corresponding to given module name ,
* or if the module name contains version number in it then it will engage
* the correct module. Both of the below two cases are valid 1.
* engageModule("addressing"); 2. engageModule("addressing-1.23");
*
* @param moduleref name of module to engage
* @throws AxisFault
*/
public void engageModule(String moduleref) throws AxisFault {
AxisModule module = getModule(moduleref);
if (module != null) {
engageModule(module);
} else {
throw new AxisFault(Messages.getMessage("modulenotavailble", moduleref));
}
}
/**
* Engages a module using given name and its version ID.
*
* @param moduleName
* @param versionID
* @throws AxisFault
*/
public void engageModule(String moduleName, String versionID)
throws AxisFault {
String actualName = Utils.getModuleName(moduleName, versionID);
AxisModule module = getModule(actualName);
if (module != null) {
engageModule(module);
} else {
throw new AxisFault(Messages.getMessage("refertoinvalidmodule"));
}
}
public void onEngage(AxisModule module, AxisDescription engager) throws AxisFault {
Iterator servicegroups = getServiceGroups();
while (servicegroups.hasNext()) {
AxisServiceGroup serviceGroup = (AxisServiceGroup) servicegroups.next();
serviceGroup.engageModule(module, engager);
}
}
/**
* To dis-engage a module from the system. This will remove all the handlers
* belonging to this module from all the handler chains.
*
* @param module module to disengage
*/
public void onDisengage(AxisModule module) throws AxisFault {
PhaseResolver phaseResolver = new PhaseResolver(this);
phaseResolver.disengageModuleFromGlobalChains(module);
Iterator serviceGroups = getServiceGroups();
while (serviceGroups.hasNext()) {
AxisServiceGroup axisServiceGroup = (AxisServiceGroup) serviceGroups.next();
axisServiceGroup.disengageModule(module);
}
}
public void notifyObservers(int event_type, AxisService service) {
AxisEvent event = new AxisEvent(event_type);
for (int i = 0; i < observersList.size(); i++) {
AxisObserver axisObserver = (AxisObserver) observersList.get(i);
try {
if (!service.isClientSide()) {
axisObserver.serviceUpdate(event, service);
}
} catch (Throwable e) {
// No need to stop the system due to this, so log and ignore
log.debug(e);
}
}
}
public void notifyObservers(int event_type, AxisModule moule) {
AxisEvent event = new AxisEvent(event_type);
for (int i = 0; i < observersList.size(); i++) {
AxisObserver axisObserver = (AxisObserver) observersList.get(i);
try {
axisObserver.moduleUpdate(event, moule);
} catch (Throwable e) {
// No need to stop the system due to this, so log and ignore
log.debug(e);
}
}
}
public void notifyObservers(int event_type, AxisServiceGroup serviceGroup) {
AxisEvent event = new AxisEvent(event_type);
for (int i = 0; i < observersList.size(); i++) {
AxisObserver axisObserver = (AxisObserver) observersList.get(i);
try {
axisObserver.serviceGroupUpdate(event, serviceGroup);
} catch (Throwable e) {
// No need to stop the system due to this, so log and ignore
log.debug(e);
}
}
}
/**
* Method removeService.
*
* @param name
* @throws AxisFault
*/
public synchronized void removeService(String name) throws AxisFault {
AxisService service = (AxisService) allServices.remove(name);
if (service != null) {
AxisServiceGroup serviceGroup = service.getAxisServiceGroup();
serviceGroup.removeService(name);
log.debug(Messages.getMessage("serviceremoved", name));
}
}
/**
* Add an AxisModule to the list of globally deployed modules.
* <p/>
* TODO: should this check for duplicate names?
*
* @param moduleName name of AxisModule to add to list.
*/
public void addGlobalModuleRef(String moduleName) {
globalModuleList.add(moduleName);
}
/**
* Engage all the previously added global modules.
*
* @throws AxisFault if an individual engageModule() fails
*/
public void engageGlobalModules() throws AxisFault {
for (Iterator i = globalModuleList.iterator(); i.hasNext();) {
engageModule((String) i.next());
}
}
public Hashtable getFaultyModules() {
return faultyModules;
}
public Hashtable getFaultyServices() {
return faultyServices;
}
public void removeFaultyService(String key) {
Iterator itr = faultyServices.keySet().iterator();
while (itr.hasNext()) {
String fullFileName = (String) itr.next();
if (fullFileName.indexOf(key) > 0) {
faultyServices.remove(fullFileName);
return;
}
}
}
// to get the out flow correpodning to the global out flow;
public ArrayList getOutFlowPhases() {
return this.outPhases;
}
/**
* @return Returns ArrayList.
*/
public ArrayList getInFaultFlowPhases() {
return inFaultPhases;
}
public ArrayList getInFlowPhases() {
return inPhasesUptoAndIncludingPostDispatch;
}
public MessageReceiver getMessageReceiver(String mepURL) {
return (MessageReceiver) messageReceivers.get(mepURL);
}
/**
* @param contentType
* @return the configured message builder implementation class name against
* the given content type.
*/
public Builder getMessageBuilder(String contentType) {
return (Builder) messageBuilders.get(contentType);
}
/**
* @param contentType
* @return the configured message formatter implementation class name
* against the given content type.
*/
public MessageFormatter getMessageFormatter(String contentType) {
return (MessageFormatter) messageFormatters.get(contentType);
}
// /**
// *
// * @deprecate Please use String version instead
// * @param qname
// * @return
// */
// public AxisModule getModule(QName qname) {
// return getModule(qname.getLocalPart());
// }
/**
* Method getModule. First it will check whether the given module is there
* in the hashMap, if so returns that and the name, which can be either with
* version string or without version string. <p/> If its not found and the
* name does not contain the version string in it then checks whether the default
* version of the module is available in the sytem for the given name, then returns
* that.
*
* @param name
* @return Returns ModuleDescription.
*/
public AxisModule getModule(String name) {
AxisModule module = (AxisModule) allModules.get(name);
if (module != null) {
return module;
}
// checks whether the version string seperator is not there in the
// module name
String moduleName = name;
String defaultModuleVersion = getDefaultModuleVersion(moduleName);
if (defaultModuleVersion != null) {
module =
(AxisModule) allModules.get(Utils.getModuleName(moduleName,
defaultModuleVersion));
if (module != null) {
return module;
}
}
return null;
}
/**
* Return the module having name=moduleName & version=moduleVersion
*
* @param moduleName The module name
* @param moduleVersion The version of the module
* @return The AxisModule having name=moduleName & version=moduleVersion
*/
public AxisModule getModule(String moduleName, String moduleVersion) {
if (moduleVersion == null && moduleVersion.trim().length() == 0) {
moduleVersion = getDefaultModuleVersion(moduleName);
}
return (AxisModule) allModules.get(Utils.getModuleName(moduleName, moduleVersion));
}
/**
* The class loader that becomes the parent of all the modules
*
* @return
*/
public ClassLoader getModuleClassLoader() {
return this.moduleClassLoader;
}
public ModuleConfiguration getModuleConfig(String moduleName) {
return (ModuleConfiguration) moduleConfigmap.get(moduleName);
}
/**
* @return Returns HashMap.
*/
public HashMap getModules() {
return allModules;
}
/**
* Get a list of the global modules
*
* @return the global module list. BE CAREFUL, this list is mutable.
* @deprecated please use addGlobalModule()
*/
public List getGlobalModules() {
return globalModuleList;
}
/**
* @return Returns ArrayList.
*/
public ArrayList getOutFaultFlowPhases() {
return outFaultPhases;
}
public PhasesInfo getPhasesInfo() {
return phasesinfo;
}
public URL getRepository() {
return axis2Repository;
}
/**
* Method getService.
*
* @param name
* @return Returns AxisService.
*/
public AxisService getService(String name) throws AxisFault {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?