org.jboss.system.server.profileservice.repository.clustered
Interface RepositoryClusteringHandler


public interface RepositoryClusteringHandler

Handles intra-cluster operations for a clustered DeploymentRepository.

Version:
$Revision: $
Author:
Brian Stansberry

Method Summary
 RepositoryItemMetadata addDeploymentContent(String vfsPath, InputStream contentIS)
          Read the content from the given input stream and add it to the repository across the cluster.
 String getLocalNodeName()
          Gets the unique id for this node within the cluster partition
 String getPartitionName()
          Gets the name of the cluster partition this hander is associated with
 org.jboss.profileservice.spi.ProfileKey getProfileKey()
          Gets the key identifying the Profile this handler is meant for
 void initialize(LocalContentManager<?> localContentManager)
          Handler should prepare itself for operation.
 boolean isImmutable()
          Gets whether this handler allows a node to push content changes to the cluster.
 boolean lockGlobally()
          Acquire a cluster-wide lock for this repository.
 boolean lockLocally()
          Acquire a local-only lock for this repository.
 void removeDeploymentContent(org.jboss.virtual.VirtualFile vf)
          Remove content from the repository across the cluster.
 void setImmutable(boolean immutable)
          Sets whether this handler allows a node to push content changes to the cluster.
 void shutdown()
          Notification that handler can perform clean up work as it will not be asked to coordinate further with the cluster.
 RepositoryContentMetadata synchronizeContent(boolean pullFromCluster)
          Synchronize this node's repository content with the rest of the cluster.
 void unlockGlobally()
          Release a cluster-wide lock obtained in lockGlobally().
 void unlockLocally()
          Release a local lock obtained in lockLocally().
 

Method Detail

getProfileKey

org.jboss.profileservice.spi.ProfileKey getProfileKey()
Gets the key identifying the Profile this handler is meant for


getPartitionName

String getPartitionName()
Gets the name of the cluster partition this hander is associated with


getLocalNodeName

String getLocalNodeName()
Gets the unique id for this node within the cluster partition


isImmutable

boolean isImmutable()
Gets whether this handler allows a node to push content changes to the cluster. If true, what changes will be accepted are an implementation detail.

Returns:
true if content changes are not allowed; false otherwise

setImmutable

void setImmutable(boolean immutable)
Sets whether this handler allows a node to push content changes to the cluster. If true, what changes will be accepted are an implementation detail.

Parameters:
immutable - true if content changes are not allowed; false otherwise

initialize

void initialize(LocalContentManager<?> localContentManager)
                throws Exception
Handler should prepare itself for operation.

Parameters:
localContentManager - object that handles repository content locally
Throws:
Exception

shutdown

void shutdown()
              throws Exception
Notification that handler can perform clean up work as it will not be asked to coordinate further with the cluster.

Throws:
Exception

lockGlobally

boolean lockGlobally()
Acquire a cluster-wide lock for this repository. Must not be invoked if a local lock is already held.

Returns:
true if the lock was acquired, false if not

lockLocally

boolean lockLocally()
Acquire a local-only lock for this repository. Will not be granted if a node already owns a cluster-wide lock.

Returns:
true if the lock was acquired, false if not

unlockGlobally

void unlockGlobally()
Release a cluster-wide lock obtained in lockGlobally().


unlockLocally

void unlockLocally()
Release a local lock obtained in lockLocally().


synchronizeContent

RepositoryContentMetadata synchronizeContent(boolean pullFromCluster)
                                             throws InconsistentRepositoryStructureException,
                                                    IOException
Synchronize this node's repository content with the rest of the cluster. This would typically involve a scan of repository content with any detected changes being propagated to the cluster.

Parameters:
pullFromCluster - true if the synchronization should include pulling in changes from the cluster, e.g. as part of the startup of a node or during a merge following the healing of a cluster split; false if the synchronization should only consist of pushing local modifications to the cluster, e.g. as part of a hot deployment scan
Returns:
metadata describing the local repository content after the synchronization
Throws:
InconsistentRepositoryStructureException
IOException

addDeploymentContent

RepositoryItemMetadata addDeploymentContent(String vfsPath,
                                            InputStream contentIS)
                                            throws IOException
Read the content from the given input stream and add it to the repository across the cluster. This is used as part of processing of programmatic changes to the repository content, as opposed to asking the handler to deal with changes made manually.

Parameters:
vfsPath - path describing where the content should be located in the repository
contentIS - input stream from which the content can be read
Returns:
metadata describing the new content
Throws:
IOException

removeDeploymentContent

void removeDeploymentContent(org.jboss.virtual.VirtualFile vf)
                             throws Exception
Remove content from the repository across the cluster. This is used as part of processing of programmatic changes to the repository content, as opposed to asking the handler to deal with changes made manually.

Parameters:
vf - VirtualFile that contains the content
Throws:
Exception


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.