org.apache.synapse.deployers
Class AbstractSynapseArtifactDeployer

java.lang.Object
  extended by org.apache.axis2.deployment.AbstractDeployer
      extended by org.apache.synapse.deployers.AbstractSynapseArtifactDeployer
All Implemented Interfaces:
Deployer
Direct Known Subclasses:
APIDeployer, EndpointDeployer, EventSourceDeployer, LocalEntryDeployer, MessageProcessorDeployer, MessageStoreDeployer, PriorityExecutorDeployer, ProxyServiceDeployer, SequenceDeployer, TaskDeployer, TemplateDeployer

public abstract class AbstractSynapseArtifactDeployer
extends AbstractDeployer

Implements 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
protected  ConfigurationContext cfgCtx
           
protected  org.apache.commons.logging.Log deployerLog
           
 
Fields inherited from class org.apache.axis2.deployment.AbstractDeployer
deploymentFileDataMap
 
Constructor Summary
protected AbstractSynapseArtifactDeployer()
           
 
Method Summary
 void deploy(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  String deploySynapseArtifact(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  ServerConfigurationInformation getServerConfigurationInformation()
           
protected  ServerContextInformation getServerContextInformation()
           
protected  SynapseConfiguration getSynapseConfiguration()
           
protected  SynapseEnvironment getSynapseEnvironment()
           
protected  void handleSynapseArtifactDeploymentError(String msg)
           
protected  void handleSynapseArtifactDeploymentError(String msg, Exception e)
           
 void init(ConfigurationContext configCtx)
          Initializes the Synapse artifact deployment
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.
 void setDirectory(String directory)
           
 void setExtension(String extension)
           
 void undeploy(String fileName)
          This is the method called by the axis2 framework for undeployment of the artifacts.
abstract  void undeploySynapseArtifact(String artifactName)
          All synapse artifact deployers MUST implement this method and it handles artifact specific undeployment tasks of those artifacts.
abstract  String updateSynapseArtifact(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  void waitForCompletion()
           
protected  void writeToFile(OMElement content, String fileName)
           
 
Methods inherited from class org.apache.axis2.deployment.AbstractDeployer
cleanup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

deployerLog

protected org.apache.commons.logging.Log deployerLog

cfgCtx

protected ConfigurationContext cfgCtx
Constructor Detail

AbstractSynapseArtifactDeployer

protected AbstractSynapseArtifactDeployer()
Method Detail

init

public void init(ConfigurationContext configCtx)
Initializes the Synapse artifact deployment

Parameters:
configCtx - Axis2 ConfigurationContext

deploy

public void deploy(DeploymentFileData deploymentFileData)
            throws DeploymentException
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.

Specified by:
deploy in interface Deployer
Overrides:
deploy in class AbstractDeployer
Parameters:
deploymentFileData - file to be used for the deployment
Throws:
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 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:
undeploy in interface Deployer
Overrides:
undeploy in class AbstractDeployer
Parameters:
fileName - file describing the artifact to be undeployed
Throws:
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(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 file
fileName - file name from which this artifact is being loaded
properties - 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(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 file
fileName - file name from which this artifact is being loaded
existingArtifactName - name of the artifact that was being deployed using the updated file
properties - 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 DeploymentException
Throws:
DeploymentException

getSynapseEnvironment

protected SynapseEnvironment getSynapseEnvironment()
                                            throws DeploymentException
Throws:
DeploymentException

getServerConfigurationInformation

protected ServerConfigurationInformation getServerConfigurationInformation()
                                                                    throws DeploymentException
Throws:
DeploymentException

getServerContextInformation

protected ServerContextInformation getServerContextInformation()
                                                        throws DeploymentException
Throws:
DeploymentException

writeToFile

protected void writeToFile(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)


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.