Package org.apache.synapse.deployers
Class AbstractSynapseArtifactDeployer
- java.lang.Object
-
- org.apache.axis2.deployment.AbstractDeployer
-
- org.apache.synapse.deployers.AbstractSynapseArtifactDeployer
-
- All Implemented Interfaces:
org.apache.axis2.deployment.Deployer
- Direct Known Subclasses:
APIDeployer,EndpointDeployer,EventSourceDeployer,ImportDeployer,InboundEndpointDeployer,LibraryArtifactDeployer,LocalEntryDeployer,MessageProcessorDeployer,MessageStoreDeployer,PriorityExecutorDeployer,ProxyServiceDeployer,SequenceDeployer,TaskDeployer,TemplateDeployer
public abstract class AbstractSynapseArtifactDeployer extends org.apache.axis2.deployment.AbstractDeployerImplements the generic logic for the synapse artifact deployment and provide a deployment framework for the synapse.Any synapse artifact which requires the hot deployment or hot update features should extend this and just needs to concentrate on the deployment logic. By default setting the file extension and directory dynamically is not supported.
- See Also:
Deployer
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.axis2.context.ConfigurationContextcfgCtxprotected StringcustomLogContentprotected org.apache.commons.logging.LogdeployerLog
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSynapseArtifactDeployer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddeploy(org.apache.axis2.deployment.repository.util.DeploymentFileData deploymentFileData)This method is called by the axis2 deployment framework and it performs a synapse artifact specific yet common across all the artifacts, set of tasks and delegate the actual deployment to the respective artifact deployers.abstract StringdeploySynapseArtifact(org.apache.axiom.om.OMElement artifactConfig, String fileName, Properties properties)All synapse artifact deployers MUST implement this method and it handles artifact specific deployment tasks of those artifacts.protected voidexecuteExtendedSynapseHandlerOnArtifactDeployment(String artifactName, String artifactType, String startTime)Execute the ExtendedSynapseHandler during the artifact deployment.protected voidexecuteSynapseHandlerOnArtifactUnDeployment(String artifactName, String artifactType, String unDeployTime)Execute the ExtendedSynapseHandler during the artifact undeployment.protected ServerConfigurationInformationgetServerConfigurationInformation()protected ServerContextInformationgetServerContextInformation()protected SynapseConfigurationgetSynapseConfiguration()protected SynapseEnvironmentgetSynapseEnvironment()protected voidhandleSynapseArtifactDeploymentError(String msg)protected voidhandleSynapseArtifactDeploymentError(String msg, Exception e)voidinit(org.apache.axis2.context.ConfigurationContext configCtx)Initializes the Synapse artifact deploymentabstract voidrestoreSynapseArtifact(String artifactName)All synapse artifact deployers MUST implement this method and it handles artifact specific restore tasks of those artifacts upon a failure of an update or undeployment.voidsetCustomLog(String artifactContainerName, String tenantId)voidsetDirectory(String directory)voidsetExtension(String extension)voidundeploy(String fileName)This is the method called by the axis2 framework for undeployment of the artifacts.abstract voidundeploySynapseArtifact(String artifactName)All synapse artifact deployers MUST implement this method and it handles artifact specific undeployment tasks of those artifacts.abstract StringupdateSynapseArtifact(org.apache.axiom.om.OMElement artifactConfig, String fileName, String existingArtifactName, Properties properties)All synapse artifact deployers MUST implement this method and it handles artifact specific update tasks of those artifacts.protected voidwaitForCompletion()protected voidwriteToFile(org.apache.axiom.om.OMElement content, String fileName)
-
-
-
Field Detail
-
deployerLog
protected org.apache.commons.logging.Log deployerLog
-
cfgCtx
protected org.apache.axis2.context.ConfigurationContext cfgCtx
-
customLogContent
protected String customLogContent
-
-
Method Detail
-
init
public void init(org.apache.axis2.context.ConfigurationContext configCtx)
Initializes the Synapse artifact deployment- Parameters:
configCtx- Axis2 ConfigurationContext
-
deploy
public void deploy(org.apache.axis2.deployment.repository.util.DeploymentFileData deploymentFileData) throws org.apache.axis2.deployment.DeploymentExceptionThis method is called by the axis2 deployment framework and it performs a synapse artifact specific yet common across all the artifacts, set of tasks and delegate the actual deployment to the respective artifact deployers.- Specified by:
deployin interfaceorg.apache.axis2.deployment.Deployer- Overrides:
deployin classorg.apache.axis2.deployment.AbstractDeployer- Parameters:
deploymentFileData- file to be used for the deployment- Throws:
org.apache.axis2.deployment.DeploymentException- in-case of an error in deploying the file- See Also:
deploySynapseArtifact(org.apache.axiom.om.OMElement, String,java.util.Properties)
-
undeploy
public void undeploy(String fileName) throws org.apache.axis2.deployment.DeploymentException
This is the method called by the axis2 framework for undeployment of the artifacts. As in the deploy case this performs some common tasks across all the synapse artifacts and fall back to the artifact specific logic of undeployment.- Specified by:
undeployin interfaceorg.apache.axis2.deployment.Deployer- Overrides:
undeployin classorg.apache.axis2.deployment.AbstractDeployer- Parameters:
fileName- file describing the artifact to be undeployed- Throws:
org.apache.axis2.deployment.DeploymentException- in case of an error in undeployment- See Also:
undeploySynapseArtifact( String)
-
setDirectory
public void setDirectory(String directory)
-
setExtension
public void setExtension(String extension)
-
deploySynapseArtifact
public abstract String deploySynapseArtifact(org.apache.axiom.om.OMElement artifactConfig, String fileName, Properties properties)
All synapse artifact deployers MUST implement this method and it handles artifact specific deployment tasks of those artifacts.- Parameters:
artifactConfig- built element representing the artifact to be deployed loaded from the filefileName- file name from which this artifact is being loadedproperties- Properties associated with the artifact- Returns:
- String artifact name created by the deployment task
- See Also:
deploy( org.apache.axis2.deployment.repository.util.DeploymentFileData)
-
updateSynapseArtifact
public abstract String updateSynapseArtifact(org.apache.axiom.om.OMElement artifactConfig, String fileName, String existingArtifactName, Properties properties)
All synapse artifact deployers MUST implement this method and it handles artifact specific update tasks of those artifacts.- Parameters:
artifactConfig- built element representing the artifact to be deployed loaded from the filefileName- file name from which this artifact is being loadedexistingArtifactName- name of the artifact that was being deployed using the updated fileproperties- bag of properties with the additional information- Returns:
- String artifact name created by the update task
-
undeploySynapseArtifact
public abstract void undeploySynapseArtifact(String artifactName)
All synapse artifact deployers MUST implement this method and it handles artifact specific undeployment tasks of those artifacts.- Parameters:
artifactName- name of the artifact to be undeployed- See Also:
undeploy(String)
-
restoreSynapseArtifact
public abstract void restoreSynapseArtifact(String artifactName)
All synapse artifact deployers MUST implement this method and it handles artifact specific restore tasks of those artifacts upon a failure of an update or undeployment.- Parameters:
artifactName- name of the artifact to be restored
-
getSynapseConfiguration
protected SynapseConfiguration getSynapseConfiguration() throws org.apache.axis2.deployment.DeploymentException
- Throws:
org.apache.axis2.deployment.DeploymentException
-
getSynapseEnvironment
protected SynapseEnvironment getSynapseEnvironment() throws org.apache.axis2.deployment.DeploymentException
- Throws:
org.apache.axis2.deployment.DeploymentException
-
getServerConfigurationInformation
protected ServerConfigurationInformation getServerConfigurationInformation() throws org.apache.axis2.deployment.DeploymentException
- Throws:
org.apache.axis2.deployment.DeploymentException
-
getServerContextInformation
protected ServerContextInformation getServerContextInformation() throws org.apache.axis2.deployment.DeploymentException
- Throws:
org.apache.axis2.deployment.DeploymentException
-
writeToFile
protected void writeToFile(org.apache.axiom.om.OMElement content, String fileName) throws Exception- Throws:
Exception
-
waitForCompletion
protected void waitForCompletion()
-
handleSynapseArtifactDeploymentError
protected void handleSynapseArtifactDeploymentError(String msg)
-
handleSynapseArtifactDeploymentError
protected void handleSynapseArtifactDeploymentError(String msg, Exception e)
-
executeExtendedSynapseHandlerOnArtifactDeployment
protected void executeExtendedSynapseHandlerOnArtifactDeployment(String artifactName, String artifactType, String startTime) throws org.apache.axis2.deployment.DeploymentException
Execute the ExtendedSynapseHandler during the artifact deployment.- Parameters:
artifactName- name of the deployed artifactartifactType- type of the deployed artifactstartTime- time the artifact was deployed- Throws:
org.apache.axis2.deployment.DeploymentException
-
executeSynapseHandlerOnArtifactUnDeployment
protected void executeSynapseHandlerOnArtifactUnDeployment(String artifactName, String artifactType, String unDeployTime) throws org.apache.axis2.deployment.DeploymentException
Execute the ExtendedSynapseHandler during the artifact undeployment.- Parameters:
artifactName- name of the undeployed artifactartifactType- type of the undeployed artifactunDeployTime- time the artifact was undeployed- Throws:
org.apache.axis2.deployment.DeploymentException
-
-