Java Code Examples for org.apache.axis2.engine.AxisConfiguration#getConfigurator()
The following examples show how to use
org.apache.axis2.engine.AxisConfiguration#getConfigurator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoadBalancerServiceComponent.java From attic-stratos with Apache License 2.0 | 6 votes |
/** * Un-registers the Endpoint deployer. * * @param axisConfig AxisConfiguration to which this deployer belongs * @param synapseEnvironment SynapseEnvironment to which this deployer belongs */ private void unregisterDeployer(AxisConfiguration axisConfig, SynapseEnvironment synapseEnvironment) throws TenantAwareLoadBalanceEndpointException { if (axisConfig != null) { DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig .getConfigurator(); String synapseConfigPath = ServiceBusUtils .getSynapseConfigAbsPath(synapseEnvironment .getServerContextInformation()); String endpointDirPath = synapseConfigPath + File.separator + MultiXMLConfigurationBuilder.ENDPOINTS_DIR; deploymentEngine.removeDeployer(endpointDirPath, ServiceBusConstants.ARTIFACT_EXTENSION); } }
Example 2
Source File: LoadBalancerServiceComponent.java From attic-stratos with Apache License 2.0 | 6 votes |
/** * Registers the Endpoint deployer. * * @param axisConfig AxisConfiguration to which this deployer belongs * @param synapseEnvironment SynapseEnvironment to which this deployer belongs */ private void registerDeployer(AxisConfiguration axisConfig, SynapseEnvironment synapseEnvironment) throws TenantAwareLoadBalanceEndpointException { SynapseConfiguration synCfg = synapseEnvironment .getSynapseConfiguration(); DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig .getConfigurator(); SynapseArtifactDeploymentStore deploymentStore = synCfg .getArtifactDeploymentStore(); String synapseConfigPath = ServiceBusUtils .getSynapseConfigAbsPath(synapseEnvironment .getServerContextInformation()); String endpointDirPath = synapseConfigPath + File.separator + MultiXMLConfigurationBuilder.ENDPOINTS_DIR; for (Endpoint ep : synCfg.getDefinedEndpoints().values()) { if (ep.getFileName() != null) { deploymentStore.addRestoredArtifact(endpointDirPath + File.separator + ep.getFileName()); } } deploymentEngine.addDeployer(new EndpointDeployer(), endpointDirPath, ServiceBusConstants.ARTIFACT_EXTENSION); }
Example 3
Source File: DataServiceCappDeployer.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * Deploy data services. * adding the data service to the data services. * there can be multiple data sources as separate xml files. * * @param artifacts list of artifacts to be deployed. * @param axisConfig axis configuration. */ private void deployDataSources(List<Artifact> artifacts, AxisConfiguration axisConfig) throws DeploymentException { for (Artifact artifact : artifacts) { if (DS_TYPE.equals(artifact.getType())) { List<CappFile> files = artifact.getFiles(); if (files == null || files.isEmpty()) { throw new DeploymentException("DataServiceCappDeployer::deployDataServices --> " + "Error No data services found in the artifact to deploy"); } for (CappFile cappFile : files) { String fileName = cappFile.getName(); String dataServiceConfigPath = artifact.getExtractedPath() + File.separator + fileName; File file = new File(dataServiceConfigPath); if (!file.exists()) { throw new DeploymentException("DataServiceCappDeployer::deployDataServices --> " + "Error Data service file cannot be found in artifact, " + "file name - " + fileName); } // access the deployment engine through axis config DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator(); Deployer deployer = deploymentEngine.getDeployer(DS_DIR, "dbs"); try { // Call the deploy method of the deployer deployer.deploy(new DeploymentFileData(new File(dataServiceConfigPath), deployer)); artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED); } catch (DeploymentException e) { artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED); throw new DeploymentException( "DataServiceCappDeployer::deployDataServices --> " + "Error in deploying data service: " + e.getMessage(), e); } } } } }
Example 4
Source File: StartupAdminServiceComponent.java From micro-integrator with Apache License 2.0 | 5 votes |
private void registerDeployer(AxisConfiguration axisConfig, SynapseEnvironment synEnv) { DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator(); SynapseArtifactDeploymentStore deploymentStore = synEnv.getSynapseConfiguration().getArtifactDeploymentStore(); String synapseConfigPath = ServiceBusUtils.getSynapseConfigAbsPath(synEnv.getServerContextInformation()); String taskDirDirPath = synapseConfigPath + File.separator + MultiXMLConfigurationBuilder.TASKS_DIR; for (Startup stp : synEnv.getSynapseConfiguration().getStartups()) { if (stp.getFileName() != null) { deploymentStore.addRestoredArtifact(taskDirDirPath + File.separator + stp.getFileName()); } } synchronized (axisConfig) { deploymentEngine.addDeployer(new TaskDeployer(), taskDirDirPath, ServiceBusConstants.ARTIFACT_EXTENSION); } }
Example 5
Source File: StartupAdminServiceComponent.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * Un-registers the Task Deployer. * * @param axisConfig AxisConfiguration to which this deployer belongs * @param synapseEnvironment SynapseEnvironment to which this deployer belongs */ private void unregistryDeployer(AxisConfiguration axisConfig, SynapseEnvironment synapseEnvironment) { if (axisConfig != null && synapseEnvironment != null) { DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator(); String synapseConfigPath = ServiceBusUtils .getSynapseConfigAbsPath(synapseEnvironment.getServerContextInformation()); String proxyDirPath = synapseConfigPath + File.separator + MultiXMLConfigurationBuilder.TASKS_DIR; deploymentEngine.removeDeployer(proxyDirPath, ServiceBusConstants.ARTIFACT_EXTENSION); } }
Example 6
Source File: DefaultAppDeployer.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * Finds the correct deployer for the given artifact type * * @param axisConfig - AxisConfiguration instance * @param artifactType - type of the artifact * @return Deployer instance */ private Deployer getDeployer(AxisConfiguration axisConfig, String artifactType) { // access the deployment engine through axis config DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator(); Deployer deployer = null; // for each service type, select the correct deployer if (AAR_TYPE.equals(artifactType)) { deployer = deploymentEngine.getDeployer("axis2services", "aar"); /* when ghost deployer is off, deployer is null since the ServiceDeployer is not registered as a normal deployer. Therefore the axis2service deployer is obtained as follows. Fix me properly. */ if (deployer == null) { deployer = deploymentEngine.getServiceDeployer(); } } else if (DS_TYPE.equals(artifactType)) { // TODO : Move data services out of carbon core deployer = deploymentEngine.getDeployer(DefaultAppDeployer.DS_DIR, "dbs"); } else if (org.wso2.micro.application.deployer.AppDeployerConstants.CARBON_APP_TYPE.equals(artifactType)) { deployer = deploymentEngine.getDeployer(AppDeployerConstants.CARBON_APPS, "car"); } return deployer; }
Example 7
Source File: SynapseAppDeployer.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * Get the deployer for the Class Mediators * * @param axisConfig AxisConfiguration instance * @return Deployer instance */ private Deployer getClassMediatorDeployer(AxisConfiguration axisConfig) { DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator(); String classMediatorPath = axisConfig.getRepository().getPath() + File.separator + SynapseAppDeployerConstants.MEDIATORS_FOLDER; return deploymentEngine. getDeployer(classMediatorPath, ServiceBusConstants.CLASS_MEDIATOR_EXTENSION); }
Example 8
Source File: SynapseAppDeployer.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * Get the deployer for the Synapse Library * * @param axisConfig AxisConfiguration instance * @return Deployer instance */ private Deployer getSynapseLibraryDeployer(AxisConfiguration axisConfig) { try { String synapseLibraryPath = axisConfig.getRepository().getPath() + SynapseAppDeployerConstants.SYNAPSE_LIBS; DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator(); deploymentEngine.addDeployer(new LibraryArtifactDeployer(), synapseLibraryPath, ServiceBusConstants.SYNAPSE_LIBRARY_EXTENSION); return deploymentEngine. getDeployer(synapseLibraryPath, ServiceBusConstants.SYNAPSE_LIBRARY_EXTENSION); } catch (Exception e) { log.error("Error occured while getting the deployer"); return null; } }
Example 9
Source File: CarbonSynapseController.java From micro-integrator with Apache License 2.0 | 5 votes |
@Override public void init(ServerConfigurationInformation serverConfigurationInformation, ServerContextInformation serverContextInformation) { Object context = serverContextInformation.getServerContext(); if (context instanceof ConfigurationContext) { AxisConfiguration axisCfg = ((ConfigurationContext) context).getAxisConfiguration(); synchronized (axisCfg) { DeploymentEngine deploymentEngine = (DeploymentEngine) axisCfg.getConfigurator(); // File carbonHome = new File(System.getProperty(ServerConstants.CARBON_HOME)); // subjected to change String carbonRepoPath = axisCfg.getRepository().getPath(); String mediatorsPath = carbonRepoPath + File.separator + "mediators"; String extensionsPath = carbonRepoPath + File.separator + "extensions"; ExtensionDeployer deployer = new ExtensionDeployer(); deploymentEngine.addDeployer(deployer, mediatorsPath, "xar"); deploymentEngine.addDeployer(deployer, extensionsPath, "xar"); deploymentEngine.addDeployer(deployer, mediatorsPath, "jar"); deploymentEngine.addDeployer(deployer, extensionsPath, "jar"); // Register deployer for class mediators String classMediatorsPath = carbonRepoPath + File.separator + "class-mediators"; deploymentEngine.addDeployer(new ClassMediatorDeployer(), classMediatorsPath, ServiceBusConstants.CLASS_MEDIATOR_EXTENSION); } this.currentConfigurationName = ((ConfigurationContext) context). getAxisConfiguration().getParameterValue( ServiceBusConstants.SYNAPSE_CURRENT_CONFIGURATION).toString(); this.synapseXMLLocation = serverConfigurationInformation.getSynapseXMLLocation(); } super.init(serverConfigurationInformation, serverContextInformation); }
Example 10
Source File: DataServiceCappDeployer.java From micro-integrator with Apache License 2.0 | 4 votes |
/** * Un-deploy data services. * removing the data service from data services. * there can be multiple data sources as separate xml files. * * @param artifacts list of artifacts to be deployed. * @param axisConfig axis configuration. */ private void undeployDataSources(List<Artifact> artifacts, AxisConfiguration axisConfig) throws DeploymentException { for (Artifact artifact : artifacts) { if (DS_TYPE.equals(artifact.getType())) { List<CappFile> files = artifact.getFiles(); if (files == null || files.isEmpty()) { throw new DeploymentException("DataServiceCappDeployer::unDeployDataServices --> " + "Error No data services found in the artifact to deploy"); } for (CappFile cappFile : files) { String fileName = cappFile.getName(); String dataServiceConfigPath = artifact.getExtractedPath() + File.separator + fileName; File file = new File(dataServiceConfigPath); if (!file.exists()) { throw new DeploymentException("DataServiceCappDeployer::unDeployDataServices --> " + "Error Data service file cannot be found in artifact, " + "file name - " + fileName); } // access the deployment engine through axis config DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator(); Deployer deployer = deploymentEngine.getDeployer(DS_DIR, "dbs"); if (AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED.equals( artifact.getDeploymentStatus())) { try { // Call the un-deploy method of the deployer deployer.undeploy(dataServiceConfigPath); artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_PENDING); File artifactFile = new File(dataServiceConfigPath); if (artifactFile.exists() && !artifactFile.delete()) { log.warn("Couldn't delete artifact file : " + dataServiceConfigPath); } } catch (DeploymentException e) { artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED); throw new DeploymentException( "DataServiceCappDeployer::unDeployDataServices --> " + "Error in un-deploying data service: " + e.getMessage(), e); } } } } } }
Example 11
Source File: SynapseAppDeployer.java From micro-integrator with Apache License 2.0 | 4 votes |
/** * Register synapse deployers to the deployment engine. * * @param axisConfig - axisConfiguration to which this deployer belongs * @param artifactType - type of the artifact * @param deployer - related deployer */ private void registerSynapseDeployer(AxisConfiguration axisConfig, String artifactType, Deployer deployer) { DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator(); String artifactDirName = getArtifactDirName(artifactType); if (artifactDirName != null) { SynapseArtifactDeploymentStore deploymentStore = getSynapseConfiguration(axisConfig).getArtifactDeploymentStore(); SynapseConfiguration synCfg = getSynapseConfiguration(axisConfig); String artifactDir = getArtifactDirPath(axisConfig, artifactDirName); switch (artifactType) { case SynapseAppDeployerConstants.SEQUENCE_TYPE: for (SequenceMediator seq : synCfg.getDefinedSequences().values()) { if (seq.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + seq.getFileName()); } } break; case SynapseAppDeployerConstants.ENDPOINT_TYPE: for (Endpoint ep : synCfg.getDefinedEndpoints().values()) { if (ep.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + ep.getFileName()); } } break; case SynapseAppDeployerConstants.PROXY_SERVICE_TYPE: for (ProxyService proxyService : synCfg.getProxyServices()) { if (proxyService.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + proxyService.getFileName()); } } break; case SynapseAppDeployerConstants.LOCAL_ENTRY_TYPE: for (Entry entry : synCfg.getDefinedEntries().values()) { if (entry.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + entry.getFileName()); } } break; case SynapseAppDeployerConstants.TASK_TYPE: for (Startup stp : synCfg.getStartups()) { if (stp.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + stp.getFileName()); } } break; case SynapseAppDeployerConstants.MESSAGE_STORE_TYPE: for (MessageStore messageStore : synCfg.getMessageStores().values()) { if (messageStore.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + messageStore.getFileName()); } } break; case SynapseAppDeployerConstants.MESSAGE_PROCESSOR_TYPE: for (MessageProcessor processor : synCfg.getMessageProcessors().values()) { if (processor.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + processor.getFileName()); } } break; case SynapseAppDeployerConstants.API_TYPE: for (API api : synCfg.getAPIs()) { if (api.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + api.getFileName()); } } break; case SynapseAppDeployerConstants.TEMPLATE_TYPE: for (TemplateMediator seqTempl : synCfg.getSequenceTemplates().values()) { if (seqTempl.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + seqTempl.getFileName()); } } for (Template epTempl : synCfg.getEndpointTemplates().values()) { if (epTempl.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + epTempl.getFileName()); } } break; case SynapseAppDeployerConstants.INBOUND_ENDPOINT_TYPE: for (InboundEndpoint inboundEndpoint : synCfg.getInboundEndpoints()) { if (inboundEndpoint.getFileName() != null) { deploymentStore.addRestoredArtifact(artifactDir + File.separator + inboundEndpoint.getFileName()); } } break; default: // do nothing } deploymentEngine.addDeployer(deployer, artifactDir, ServiceBusConstants.ARTIFACT_EXTENSION); } }
Example 12
Source File: AppDeployerUtils.java From micro-integrator with Apache License 2.0 | 3 votes |
/** * Finds the correct deployer for the given directory and extension * * @param axisConfig - AxisConfiguration instance * @param directory - Directory to retrieve the deployer * @param extension - Extension of the deployable artifact * @return Deployer instance * */ public static Deployer getArtifactDeployer(AxisConfiguration axisConfig, String directory, String extension) { // access the deployment engine through axis config DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator(); return deploymentEngine.getDeployer(directory, extension); }