org.apache.s4.deploy
Class DistributedDeploymentManager

java.lang.Object
  extended by org.apache.s4.deploy.DistributedDeploymentManager
All Implemented Interfaces:
DeploymentManager

public class DistributedDeploymentManager
extends java.lang.Object
implements DeploymentManager

Monitors application availability on a given s4 cluster. Starts the application when available.

More specifically, this class observes the children of /<s4-cluster-name>/apps. Children correspond to S4 applications. A child's metadata contains a URI that refers to the s4r file that contains the s4 application code.

At startup, existing applications are loaded by, for each detected application:

  1. reading the associated URI
  2. fetching the s4r archive from that URI, through the protocol specified in the URI, and copying the s4r to a local directory. Protocol handlers are not currently pluggable and must be implemented in this class.
  3. loading and starting the application

Then, whenever new app children are detected, the deployment manager re-executes the above steps for those new applications


Field Summary
static java.lang.String S4R_URI
           
 
Constructor Summary
DistributedDeploymentManager(java.lang.String clusterName, java.lang.String zookeeperAddress, int sessionTimeout, int connectionTimeout, Server server)
           
 
Method Summary
 void deployApplication()
           
 java.io.InputStream fetchS4App(java.net.URI uri)
           
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S4R_URI

public static final java.lang.String S4R_URI
See Also:
Constant Field Values
Constructor Detail

DistributedDeploymentManager

@Inject
public DistributedDeploymentManager(java.lang.String clusterName,
                                           java.lang.String zookeeperAddress,
                                           int sessionTimeout,
                                           int connectionTimeout,
                                           Server server)
Method Detail

deployApplication

public void deployApplication()
                       throws DeploymentFailedException
Throws:
DeploymentFailedException

fetchS4App

public java.io.InputStream fetchS4App(java.net.URI uri)
                               throws DeploymentFailedException
Throws:
DeploymentFailedException

start

public void start()
Specified by:
start in interface DeploymentManager