| Method from org.apache.axis2.deployment.DeploymentEngine Detail: |
public static void addNewModule(AxisModule modulemetadata,
AxisConfiguration axisConfiguration) throws AxisFault {
Flow inflow = modulemetadata.getInFlow();
ClassLoader moduleClassLoader = modulemetadata.getModuleClassLoader();
if (inflow != null) {
Utils.addFlowHandlers(inflow, moduleClassLoader);
}
Flow outFlow = modulemetadata.getOutFlow();
if (outFlow != null) {
Utils.addFlowHandlers(outFlow, moduleClassLoader);
}
Flow faultInFlow = modulemetadata.getFaultInFlow();
if (faultInFlow != null) {
Utils.addFlowHandlers(faultInFlow, moduleClassLoader);
}
Flow faultOutFlow = modulemetadata.getFaultOutFlow();
if (faultOutFlow != null) {
Utils.addFlowHandlers(faultOutFlow, moduleClassLoader);
}
axisConfiguration.addModule(modulemetadata);
log.debug(Messages.getMessage(DeploymentErrorMsgs.ADDING_NEW_MODULE));
}
|
public static void addServiceGroup(AxisServiceGroup serviceGroup,
ArrayList serviceList,
URL serviceLocation,
DeploymentFileData currentDeploymentFile,
AxisConfiguration axisConfiguration) throws AxisFault {
fillServiceGroup(serviceGroup, serviceList, serviceLocation, axisConfiguration);
axisConfiguration.addServiceGroup(serviceGroup);
if (currentDeploymentFile != null) {
addAsWebResources(currentDeploymentFile.getFile(),
serviceGroup.getServiceGroupName(), serviceGroup);
}
}
|
public void addWSToDeploy(DeploymentFileData file) {
wsToDeploy.add(file);
}
|
public void addWSToUndeploy(WSInfo file) {
wsToUnDeploy.add(file);
}
|
public static AxisModule buildModule(File modulearchive,
AxisConfiguration config) throws DeploymentException {
final String MODULE_DEPLOYER = "moduleDeployer";
AxisModule axismodule;
ModuleDeployer deployer = (ModuleDeployer) config.getParameterValue(MODULE_DEPLOYER);
try {
if (deployer == null) {
deployer = new ModuleDeployer(config);
config.addParameter(MODULE_DEPLOYER, deployer);
}
DeploymentFileData currentDeploymentFile = new DeploymentFileData(modulearchive,
deployer);
axismodule = new AxisModule();
ArchiveReader archiveReader = new ArchiveReader();
currentDeploymentFile.setClassLoader(false, config.getModuleClassLoader(), null);
axismodule.setModuleClassLoader(currentDeploymentFile.getClassLoader());
archiveReader.readModuleArchive(currentDeploymentFile, axismodule,
false, config);
ClassLoader moduleClassLoader = axismodule.getModuleClassLoader();
Flow inflow = axismodule.getInFlow();
if (inflow != null) {
Utils.addFlowHandlers(inflow, moduleClassLoader);
}
Flow outFlow = axismodule.getOutFlow();
if (outFlow != null) {
Utils.addFlowHandlers(outFlow, moduleClassLoader);
}
Flow faultInFlow = axismodule.getFaultInFlow();
if (faultInFlow != null) {
Utils.addFlowHandlers(faultInFlow, moduleClassLoader);
}
Flow faultOutFlow = axismodule.getFaultOutFlow();
if (faultOutFlow != null) {
Utils.addFlowHandlers(faultOutFlow, moduleClassLoader);
}
} catch (AxisFault axisFault) {
throw new DeploymentException(axisFault);
}
return axismodule;
}
Builds an AxisModule for a given module archive file. This does not
called the init method since there is no reference to configuration context
so who ever create module using this has to called module.init if it is
required |
public static AxisService buildService(InputStream serviceInputStream,
ConfigurationContext configCtx) throws DeploymentException {
AxisService axisService = new AxisService();
try {
ServiceBuilder builder = new ServiceBuilder(serviceInputStream, configCtx, axisService);
builder.populateService(builder.buildOM());
} catch (AxisFault axisFault) {
throw new DeploymentException(axisFault);
} catch (XMLStreamException e) {
throw new DeploymentException(e);
}
return axisService;
}
Fills an axisservice object using services.xml. First creates
an axisservice object using WSDL and then fills it using the given services.xml.
Loads all the required class and builds the chains, finally adds the
servicecontext to EngineContext and axisservice into EngineConfiguration. |
public static AxisServiceGroup buildServiceGroup(InputStream servicesxml,
ClassLoader classLoader,
String serviceGroupName,
ConfigurationContext configCtx,
ArchiveReader archiveReader,
HashMap wsdlServices) throws AxisFault {
DeploymentFileData currentDeploymentFile = new DeploymentFileData(null, null);
currentDeploymentFile.setClassLoader(classLoader);
AxisServiceGroup serviceGroup = new AxisServiceGroup();
serviceGroup.setServiceGroupClassLoader(classLoader);
serviceGroup.setServiceGroupName(serviceGroupName);
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
try {
ArrayList serviceList = archiveReader.buildServiceGroup(servicesxml,
currentDeploymentFile,
serviceGroup,
wsdlServices, configCtx);
fillServiceGroup(serviceGroup, serviceList, null, axisConfig);
return serviceGroup;
} catch (XMLStreamException e) {
throw AxisFault.makeFault(e);
}
}
To build a AxisServiceGroup for a given services.xml
You have to add the created group into AxisConfig |
public void cleanup() {
if (axisConfig.getModuleClassLoader() instanceof JarFileClassLoader) {
((JarFileClassLoader)axisConfig.getModuleClassLoader()).destroy();
}
if (axisConfig.getServiceClassLoader() instanceof JarFileClassLoader) {
((JarFileClassLoader)axisConfig.getServiceClassLoader()).destroy();
}
if (axisConfig.getSystemClassLoader() instanceof JarFileClassLoader) {
((JarFileClassLoader)axisConfig.getSystemClassLoader()).destroy();
}
if (scheduler != null) {
scheduler.cleanup();
}
}
|
public void doDeploy() {
try {
if (wsToDeploy.size() > 0) {
for (int i = 0; i < wsToDeploy.size(); i++) {
DeploymentFileData fileToDeploy = (DeploymentFileData) wsToDeploy.get(i);
try {
fileToDeploy.deploy();
} catch (DeploymentException e) {
// TODO : This probably isn't sufficient. Maybe provide an option to stop?
log.info(e);
}
}
}
} finally {
wsToDeploy.clear();
}
}
|
public void engageModules() throws AxisFault {
axisConfig.engageGlobalModules();
}
Checks if the modules, referred by server.xml, exist or that they are deployed. |
protected static void fillServiceGroup(AxisServiceGroup serviceGroup,
ArrayList serviceList,
URL serviceLocation,
AxisConfiguration axisConfig) throws AxisFault {
// serviceGroup.setParent(axisConfig);
// module from services.xml at serviceGroup level
ArrayList groupModules = serviceGroup.getModuleRefs();
serviceGroup.setParent(axisConfig);
for (int i = 0; i < groupModules.size(); i++) {
String moduleName = (String) groupModules.get(i);
AxisModule module = axisConfig.getModule(moduleName);
if (module != null) {
serviceGroup.engageModule(axisConfig.getModule(moduleName));
} else {
throw new DeploymentException(
Messages.getMessage(
DeploymentErrorMsgs.BAD_MODULE_FROM_SERVICE,
serviceGroup.getServiceGroupName(), moduleName));
}
}
Iterator services = serviceList.iterator();
while (services.hasNext()) {
AxisService axisService = (AxisService) services.next();
axisService.setUseDefaultChains(false);
axisService.setFileName(serviceLocation);
serviceGroup.addService(axisService);
// modules from < service >
ArrayList list = axisService.getModules();
for (int i = 0; i < list.size(); i++) {
AxisModule module = axisConfig.getModule((String) list.get(i));
if (module == null) {
throw new DeploymentException(
Messages.getMessage(
DeploymentErrorMsgs.BAD_MODULE_FROM_SERVICE,
axisService.getName(),
((QName) list.get(i)).getLocalPart()));
}
axisService.engageModule(module);
}
for (Iterator iterator = axisService.getOperations(); iterator.hasNext();) {
AxisOperation opDesc = (AxisOperation) iterator.next();
ArrayList modules = opDesc.getModuleRefs();
for (int i = 0; i < modules.size(); i++) {
String moduleName = (String) modules.get(i);
AxisModule module = axisConfig.getModule(moduleName);
if (module != null) {
opDesc.engageModule(module);
} else {
throw new DeploymentException(
Messages.getMessage(
DeploymentErrorMsgs.BAD_MODULE_FROM_OPERATION,
opDesc.getName().getLocalPart(),
moduleName));
}
}
}
}
}
|
public AxisConfiguration getAxisConfig() {
return axisConfig;
}
|
public static String getAxisServiceName(String fileName) {
char seperator = '.";
String value;
int index = fileName.lastIndexOf(seperator);
if (index > 0) {
value = fileName.substring(0, index);
return value;
}
return fileName;
}
Retrieves service name from the archive file name.
If the archive file name is service1.aar , then axis2 service name would be service1 |
public Deployer getDeployer(String directory,
String extension) {
Map< String, Deployer > extensionMap = deployerMap.get(directory);
return (extensionMap != null) ? extensionMap.get(extension) : null;
}
|
public Deployer getDeployerForExtension(String extension) {
return (Deployer) extensionToDeployerMappingMap.get(extension);
}
|
public Map getDeployers() {
return this.deployerMap;
}
|
protected ArrayList getFileList(URL fileListUrl) {
ArrayList fileList = new ArrayList();
InputStream in;
try {
in = fileListUrl.openStream();
} catch (IOException e) {
return fileList;
}
BufferedReader input = null;
try {
input = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = input.readLine()) != null) {
line = line.trim();
if (line.length() > 0 && line.charAt(0)!='#") {
fileList.add(line);
}
}
} catch (IOException ex) {
ex.printStackTrace();
} finally {
try {
if (input != null) {
input.close();
}
}
catch (IOException ex) {
ex.printStackTrace();
}
}
return fileList;
}
|
public AxisModule getModule(String moduleName) throws AxisFault {
return axisConfig.getModule(moduleName);
}
|
public ModuleDeployer getModuleDeployer() {
return moduleDeployer;
}
|
public File getModulesDir() {
return modulesDir;
}
|
public RepositoryListener getRepoListener() {
return repoListener;
}
|
public File getRepositoryDir() {
return repositoryDir;
}
|
protected String getRepositoryPath(File repository) {
try {
return repository.getCanonicalPath();
} catch (IOException e) {
return repository.getAbsolutePath();
}
}
|
public ServiceDeployer getServiceDeployer() {
return serviceDeployer;
}
|
public File getServicesDir() {
return servicesDir;
}
|
public static String getWebLocationString() {
return webLocationString;
}
|
public boolean isHotUpdate() {
return hotUpdate;
}
|
protected MessageReceiver loadDefaultMessageReceiver(String mepURL,
AxisService service) {
MessageReceiver messageReceiver;
if (mepURL == null) {
mepURL = WSDL2Constants.MEP_URI_IN_OUT;
}
if (service != null) {
messageReceiver = service.getMessageReceiver(mepURL);
if (messageReceiver != null) {
return messageReceiver;
}
}
return axisConfig.getMessageReceiver(mepURL);
}
|
public void loadFromClassPath() throws DeploymentException {
//loading modules from the classpath
new RepositoryListener(this, true);
org.apache.axis2.util.Utils.calculateDefaultModuleVersion(
axisConfig.getModules(), axisConfig);
axisConfig.validateSystemPredefinedPhases();
try {
engageModules();
} catch (AxisFault axisFault) {
log.info(Messages.getMessage(DeploymentErrorMsgs.MODULE_VALIDATION_FAILED,
axisFault.getMessage()));
throw new DeploymentException(axisFault);
}
}
|
public void loadRepository(String repoDir) throws DeploymentException {
File axisRepo = new File(repoDir);
if (!axisRepo.exists()) {
throw new DeploymentException(
Messages.getMessage("cannotfindrepo", repoDir));
}
setDeploymentFeatures();
prepareRepository(repoDir);
// setting the CLs
setClassLoaders(repoDir);
repoListener = new RepositoryListener(this, false);
org.apache.axis2.util.Utils
.calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
try {
try {
axisConfig.setRepository(axisRepo.toURL());
} catch (MalformedURLException e) {
log.info(e.getMessage());
}
axisConfig.validateSystemPredefinedPhases();
} catch (AxisFault axisFault) {
throw new DeploymentException(axisFault);
}
}
|
public void loadRepositoryFromURL(URL repoURL) throws DeploymentException {
try {
String path = modulesPath == null ? DeploymentConstants.MODULE_PATH : modulesPath;
if (!path.endsWith("/")) {
path = path + "/";
}
String repoPath = repoURL.getPath();
if (!repoPath.endsWith("/")) {
repoPath += "/";
repoURL = new URL(repoURL.getProtocol() + "://" + repoPath);
}
URL moduleDir = new URL(repoURL, path);
URL filelisturl = new URL(moduleDir, "modules.list");
ArrayList files = getFileList(filelisturl);
Iterator fileIterator = files.iterator();
while (fileIterator.hasNext()) {
String fileUrl = (String) fileIterator.next();
if (fileUrl.endsWith(".mar")) {
URL moduleurl = new URL(moduleDir, fileUrl);
ClassLoader deploymentClassLoader =
Utils.createClassLoader(
new URL[]{moduleurl},
axisConfig.getModuleClassLoader(),
true,
(File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
AxisModule module = new AxisModule();
module.setModuleClassLoader(deploymentClassLoader);
module.setParent(axisConfig);
String moduleFile = fileUrl.substring(0, fileUrl.indexOf(".mar"));
if (module.getName() == null) {
module.setName(org.apache.axis2.util.Utils.getModuleName(moduleFile));
module.setVersion(org.apache.axis2.util.Utils.getModuleVersion(moduleFile));
}
populateModule(module, moduleurl);
module.setFileName(moduleurl);
addNewModule(module, axisConfig);
log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
org.apache.axis2.util.Utils.getModuleName(module.getName(),
module.getVersion()),
moduleurl.toString()));
}
}
org.apache.axis2.util.Utils.
calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
axisConfig.validateSystemPredefinedPhases();
} catch (MalformedURLException e) {
throw new DeploymentException(e);
} catch (IOException e) {
throw new DeploymentException(e);
}
}
|
public static AxisServiceGroup loadServiceGroup(File serviceFile,
ConfigurationContext configCtx) throws AxisFault {
try {
DeploymentFileData currentDeploymentFile = new DeploymentFileData(serviceFile, null);
DeploymentClassLoader classLoader = Utils.createClassLoader(serviceFile);
currentDeploymentFile.setClassLoader(classLoader);
AxisServiceGroup serviceGroup = new AxisServiceGroup();
serviceGroup.setServiceGroupClassLoader(classLoader);
// Drop the extension and take the name
String fileName = serviceFile.getName();
String serviceGroupName = fileName.substring(0, fileName.lastIndexOf("."));
serviceGroup.setServiceGroupName(serviceGroupName);
AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
ArchiveReader archiveReader = new ArchiveReader();
HashMap wsdlServices = archiveReader.processWSDLs(currentDeploymentFile);
InputStream serviceXml = classLoader.getResourceAsStream("META-INF/services.xml");
ArrayList serviceList = archiveReader.buildServiceGroup(serviceXml,
currentDeploymentFile,
serviceGroup,
wsdlServices, configCtx);
fillServiceGroup(serviceGroup, serviceList, null, axisConfig);
return serviceGroup;
} catch (Exception e) {
throw new DeploymentException(e);
}
}
|
public void loadServices() {
repoListener.checkServices();
if (hotDeployment) {
startSearch(repoListener);
}
}
|
public void loadServicesFromUrl(URL repoURL) {
try {
String path = servicesPath == null ? DeploymentConstants.SERVICE_PATH : servicesPath;
if (!path.endsWith("/")) {
path += "/";
}
String repoPath = repoURL.getPath();
if (!repoPath.endsWith("/")) {
repoPath += "/";
repoURL = new URL(repoURL.getProtocol() + "://" + repoPath);
}
URL servicesDir = new URL(repoURL, path);
URL filelisturl = new URL(servicesDir, "services.list");
ArrayList files = getFileList(filelisturl);
for (Iterator fileIterator = files.iterator();
fileIterator.hasNext();) {
String fileUrl = (String) fileIterator.next();
if (fileUrl.endsWith(".aar")) {
AxisServiceGroup serviceGroup = new AxisServiceGroup();
URL servicesURL = new URL(servicesDir, fileUrl);
ArrayList servicelist =
populateService(serviceGroup,
servicesURL,
fileUrl.substring(0, fileUrl.indexOf(".aar")));
addServiceGroup(serviceGroup, servicelist, servicesURL, null, axisConfig);
log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
org.apache.axis2.util.Utils.getModuleName(serviceGroup.getServiceGroupName()),
servicesURL.toString()));
}
}
//Loading other type of services such as custom deployers
loadCustomServices(repoURL);
} catch (MalformedURLException e) {
log.error(e.getMessage(), e);
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
|
public AxisConfiguration populateAxisConfiguration(InputStream in) throws DeploymentException {
axisConfig = new AxisConfiguration();
AxisConfigBuilder builder = new AxisConfigBuilder(in, axisConfig, this);
builder.populateConfig();
try {
if (in != null) {
in.close();
}
} catch (IOException e) {
log.info("error in closing input stream");
}
moduleDeployer = new ModuleDeployer(axisConfig);
return axisConfig;
}
To get AxisConfiguration for a given inputStream this method can be used.
The inputstream should be a valid axis2.xml , else you will be getting
DeploymentExceptions.
First creat a AxisConfiguration using given inputSream , and then it will
try to find the repository location parameter from AxisConfiguration, so
if user has add a parameter with the name "repository" , then the value
specified by that parameter will be the repository and system will try to
load modules and services from that repository location if it a valid
location. hot deployment and hot update will work as usual in this case.
You will be getting AxisConfiguration corresponding to given inputstream
if it is valid , if something goes wrong you will be getting
DeploymentException |
protected ArrayList populateService(AxisServiceGroup serviceGroup,
URL servicesURL,
String serviceName) throws DeploymentException {
try {
serviceGroup.setServiceGroupName(serviceName);
ClassLoader serviceClassLoader = Utils.createClassLoader(
new URL[]{servicesURL},
axisConfig.getServiceClassLoader(),
true,
(File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
String metainf = "meta-inf";
serviceGroup.setServiceGroupClassLoader(serviceClassLoader);
//processing wsdl.list
InputStream wsdlfilesStream =
serviceClassLoader.getResourceAsStream("meta-inf/wsdl.list");
if (wsdlfilesStream == null) {
wsdlfilesStream = serviceClassLoader.getResourceAsStream("META-INF/wsdl.list");
if (wsdlfilesStream != null) {
metainf = "META-INF";
}
}
HashMap servicesMap = new HashMap();
if (wsdlfilesStream != null) {
ArchiveReader reader = new ArchiveReader();
BufferedReader input = new BufferedReader(new InputStreamReader(wsdlfilesStream));
String line;
while ((line = input.readLine()) != null) {
line = line.trim();
if (line.length() > 0 && line.charAt(0)!='#") {
line = metainf + "/" + line;
try {
List services = reader.getAxisServiceFromWsdl(
serviceClassLoader.getResourceAsStream(line),
serviceClassLoader, line);
if (services != null) {
for (int i = 0; i < services.size(); i++) {
AxisService axisService = (AxisService) services.get(i);
servicesMap.put(axisService.getName(), axisService);
}
}
} catch (Exception e) {
throw new DeploymentException(e);
}
}
}
}
InputStream servicexmlStream =
serviceClassLoader.getResourceAsStream("META-INF/services.xml");
if (servicexmlStream == null) {
servicexmlStream = serviceClassLoader.getResourceAsStream("meta-inf/services.xml");
} else {
metainf = "META-INF";
}
if (servicexmlStream == null) {
throw new DeploymentException(
Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND,
servicesURL.toString()));
}
DescriptionBuilder builder = new DescriptionBuilder(servicexmlStream, configContext);
OMElement rootElement = builder.buildOM();
String elementName = rootElement.getLocalName();
if (TAG_SERVICE.equals(elementName)) {
AxisService axisService = null;
String wsdlLocation = "META-INF/service.wsdl";
InputStream wsdlStream =
serviceClassLoader.getResourceAsStream(wsdlLocation);
URL wsdlURL = serviceClassLoader.getResource(metainf + "/service.wsdl");
if (wsdlStream == null) {
wsdlLocation = "META-INF/" + serviceName + ".wsdl";
wsdlStream = serviceClassLoader
.getResourceAsStream(wsdlLocation);
wsdlURL = serviceClassLoader.getResource(wsdlLocation);
}
if (wsdlStream != null) {
WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
new WSDL11ToAxisServiceBuilder(wsdlStream, null, null);
File file = Utils.toFile(servicesURL);
if(file != null && file.exists()){
wsdl2AxisServiceBuilder.setCustomWSLD4JResolver(
new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream));
wsdl2AxisServiceBuilder.setCustomResolver(
new AARFileBasedURIResolver(file));
}
if (wsdlURL != null) {
wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString());
}
axisService = wsdl2AxisServiceBuilder.populateService();
axisService.setWsdlFound(true);
axisService.setCustomWsdl(true);
axisService.setName(serviceName);
}
if (axisService == null) {
axisService = new AxisService(serviceName);
}
axisService.setParent(serviceGroup);
axisService.setClassLoader(serviceClassLoader);
ServiceBuilder serviceBuilder = new ServiceBuilder(configContext, axisService);
AxisService service = serviceBuilder.populateService(rootElement);
ArrayList serviceList = new ArrayList();
serviceList.add(service);
return serviceList;
} else if (TAG_SERVICE_GROUP.equals(elementName)) {
ServiceGroupBuilder groupBuilder = new ServiceGroupBuilder(rootElement, servicesMap,
configContext);
ArrayList servicList = groupBuilder.populateServiceGroup(serviceGroup);
Iterator serviceIterator = servicList.iterator();
while (serviceIterator.hasNext()) {
AxisService axisService = (AxisService) serviceIterator.next();
String wsdlLocation = "META-INF/service.wsdl";
InputStream wsdlStream =
serviceClassLoader.getResourceAsStream(wsdlLocation);
URL wsdlURL = serviceClassLoader.getResource(wsdlLocation);
if (wsdlStream == null) {
wsdlLocation = "META-INF/" + serviceName + ".wsdl";
wsdlStream = serviceClassLoader
.getResourceAsStream(wsdlLocation);
wsdlURL =
serviceClassLoader.getResource(wsdlLocation);
}
if (wsdlStream != null) {
WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
new WSDL11ToAxisServiceBuilder(wsdlStream, axisService);
File file = Utils.toFile(servicesURL);
if(file != null && file.exists()){
wsdl2AxisServiceBuilder.setCustomWSLD4JResolver(
new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream));
wsdl2AxisServiceBuilder.setCustomResolver(
new AARFileBasedURIResolver(file));
}
if (wsdlURL != null) {
wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString());
}
axisService = wsdl2AxisServiceBuilder.populateService();
axisService.setWsdlFound(true);
axisService.setCustomWsdl(true);
// Set the default message receiver for the operations that were
// not listed in the services.xml
Iterator operations = axisService.getOperations();
while (operations.hasNext()) {
AxisOperation operation = (AxisOperation) operations.next();
if (operation.getMessageReceiver() == null) {
operation.setMessageReceiver(loadDefaultMessageReceiver(
operation.getMessageExchangePattern(), axisService));
}
}
}
}
return servicList;
}
} catch (IOException e) {
throw new DeploymentException(e);
} catch (XMLStreamException e) {
throw new DeploymentException(e);
}
return null;
}
|
protected void prepareRepository(String repositoryName) {
repositoryDir = new File(repositoryName);
if (servicesPath != null) {
servicesDir = new File(servicesPath);
if (!servicesDir.exists()) {
servicesDir = new File(repositoryDir, servicesPath);
}
} else {
servicesDir = new File(repositoryDir, DeploymentConstants.SERVICE_PATH);
}
if (!servicesDir.exists()) {
log.info(Messages.getMessage("noservicedirfound", getRepositoryPath(repositoryDir)));
}
if (modulesPath != null) {
modulesDir = new File(modulesPath);
if (!modulesDir.exists()) {
modulesDir = new File(repositoryDir, modulesPath);
}
} else {
modulesDir = new File(repositoryDir, DeploymentConstants.MODULE_PATH);
}
if (!modulesDir.exists()) {
log.info(Messages.getMessage("nomoduledirfound", getRepositoryPath(repositoryDir)));
}
}
Creates directories for modules/services, copies configuration xml from class loader if necessary |
protected void setClassLoaders(String axis2repoURI) throws DeploymentException {
ClassLoader sysClassLoader =
Utils.getClassLoader(Thread.currentThread().getContextClassLoader(), axis2repoURI);
axisConfig.setSystemClassLoader(sysClassLoader);
if (servicesDir.exists()) {
axisConfig.setServiceClassLoader(
Utils.getClassLoader(axisConfig.getSystemClassLoader(), servicesDir));
} else {
axisConfig.setServiceClassLoader(axisConfig.getSystemClassLoader());
}
if (modulesDir.exists()) {
axisConfig.setModuleClassLoader(Utils.getClassLoader(axisConfig.getSystemClassLoader(),
modulesDir));
} else {
axisConfig.setModuleClassLoader(axisConfig.getSystemClassLoader());
}
}
To set the all the classLoader hierarchy this method can be used , the top most parent is
CCL then SCL(system Class Loader)
CCL
:
SCL
: :
MCCL SCCL
: :
MCL SCL
MCCL : module common class loader
SCCL : Service common class loader
MCL : module class loader
SCL : Service class loader |
public void setConfigContext(ConfigurationContext configContext) {
this.configContext = configContext;
initializeDeployers(this.configContext);
}
|
public void setDeployers(Map deployerMap) {
this.deployerMap = deployerMap;
}
|
protected void setDeploymentFeatures() {
Parameter hotDeployment = axisConfig.getParameter(TAG_HOT_DEPLOYMENT);
Parameter hotUpdate = axisConfig.getParameter(TAG_HOT_UPDATE);
if (hotDeployment != null) {
this.hotDeployment = JavaUtils.isTrue(hotDeployment.getValue(), true);
}
if (hotUpdate != null) {
this.hotUpdate = JavaUtils.isTrue(hotUpdate.getValue(), true);
}
String serviceDirPara = (String)
axisConfig.getParameterValue(DeploymentConstants.SERVICE_DIR_PATH);
if (serviceDirPara != null) {
servicesPath = serviceDirPara;
}
String moduleDirPara = (String)
axisConfig.getParameterValue(DeploymentConstants.MODULE_DRI_PATH);
if (moduleDirPara != null) {
modulesPath = moduleDirPara;
}
}
Sets hotDeployment and hot update. |
public void setExtensionToDeployerMappingMap(HashMap extensionToDeployerMappingMap) {
this.extensionToDeployerMappingMap = extensionToDeployerMappingMap;
}
|
public static void setWebLocationString(String webLocationString) {
DeploymentEngine.webLocationString = webLocationString;
}
|
protected void startSearch(RepositoryListener listener) {
scheduler = new Scheduler();
scheduler.schedule(new SchedulerTask(listener), new DeploymentIterator());
}
Starts the Deployment engine to perform Hot deployment and so on. |
public void unDeploy() {
try {
if (wsToUnDeploy.size() > 0) {
for (int i = 0; i < wsToUnDeploy.size(); i++) {
WSInfo wsInfo = (WSInfo) wsToUnDeploy.get(i);
if (wsInfo.getType() == WSInfo.TYPE_SERVICE) {
//No matter what we need to undeploy the service
// if user has deleted the file from the repository
serviceDeployer.unDeploy(wsInfo.getFileName());
} else {
//We need to undeploy the service whether we have enable hotUpdate or not ,
// o.w what happen if someone delete the service from the repo
Deployer deployer = wsInfo.getDeployer();
if (deployer != null) {
deployer.unDeploy(wsInfo.getFileName());
}
}
}
}
} catch (Exception e) {
log.info(e);
}
wsToUnDeploy.clear();
}
|