org.jboss.system.server.profileservice.repository.clustered.local
Interface LocalContentManager<T extends SynchronizationActionContext>

All Known Implementing Classes:
AbstractLocalContentManager, FilesystemLocalContentManager

public interface LocalContentManager<T extends SynchronizationActionContext>

Object responsible for the local persistence operations associated with a ClusteredDeploymentRepository.

Version:
$Revision: $
Author:
Brian Stansberry

Method Summary
 void commitSynchronization(SynchronizationId<?> id)
          Complete the two-phase commit process for the cluster synchronization that has been prepared.
 RepositoryContentMetadata createEmptyContentMetadata()
          Creates a new RepositoryContentMetadata with a child RepositoryRootMetadata for each of this persister's URIs, but no RepositoryItemMetadatas under those roots.
 RepositoryContentMetadata getContentMetadataForAdd(RepositoryItemMetadata toAdd, InputStream contentIS)
          Generate content metadata that would reflect what the metadata would look like if an item with path vfsPath were added.
 RepositoryContentMetadata getContentMetadataForRemove(org.jboss.virtual.VirtualFile vf)
          Generate content metadata that would reflect what the metadata would look like if an item with path vfsPath were removed.
 RepositoryContentMetadata getCurrentContentMetadata()
          Scan the persistent store for the current content metadata.
 RepositoryItemMetadata getItemForAddition(String vfsPath)
          Gets a RepositoryItemMetadata that will describe an item that may be added.
 RepositoryContentMetadata getOfficialContentMetadata()
          Gets the "official" record of the contents of the persistent store.
 org.jboss.virtual.VirtualFile getVirtualFileForItem(RepositoryItemMetadata item)
          Get a VirtualFile for the content indicated by item.
 List<? extends SynchronizationAction<T>> initiateSynchronization(SynchronizationId<?> id, List<ContentModification> modifications, RepositoryContentMetadata toInstall, boolean localLed)
          Initiate a process of synchronizing this node's persistent store with the rest of the cluster
 void installCurrentContentMetadata()
          Install the result from the latest call to getCurrentContentMetadata() as the "official" content metadata.
 boolean prepareSynchronization(SynchronizationId<?> id)
          Execute the prepare phase of the two phase commit process for the cluster synchronization that has been initialized.
 void rollbackSynchronization(SynchronizationId<?> id)
          Roll back the cluster synchronization.
 

Method Detail

getOfficialContentMetadata

RepositoryContentMetadata getOfficialContentMetadata()
Gets the "official" record of the contents of the persistent store. This is the version persisted to disk following synchronization of changes with the cluster.

Returns:
the content metadata

getCurrentContentMetadata

RepositoryContentMetadata getCurrentContentMetadata()
                                                    throws IOException
Scan the persistent store for the current content metadata. This is not the "official" metadata that has been persisted, as any changes between it and the official version have not been synchronized with the cluster.

Returns:
the content metadata
Throws:
IOException

initiateSynchronization

List<? extends SynchronizationAction<T>> initiateSynchronization(SynchronizationId<?> id,
                                                                 List<ContentModification> modifications,
                                                                 RepositoryContentMetadata toInstall,
                                                                 boolean localLed)
Initiate a process of synchronizing this node's persistent store with the rest of the cluster

Parameters:
id - a unique id for this cluster synchronization process
modifications - the overall list of modifications that will occur during this process
toInstall - TODO
localLed - true if this node is driving the synchronization, false if another node is
Returns:
list of SynchronizationActions each of which can be executed by the caller to fulfill a portion of this node's role in the overall cluster synchronization
Throws:
IllegalStateException - if another synchronization process has been initiated and not yet completed

prepareSynchronization

boolean prepareSynchronization(SynchronizationId<?> id)
Execute the prepare phase of the two phase commit process for the cluster synchronization that has been initialized.

Parameters:
id - id of the synchronization. Cannot be null
Returns:
true if the prepare phase was successful; false if not and the synchronization needs to be rolled back
Throws:
IllegalStateException - if id is not equal to the id of an uncompleted synchronization started via #initiateSynchronization(SynchronizationId, List, RepsitoryContentMetadata, boolean)

commitSynchronization

void commitSynchronization(SynchronizationId<?> id)
Complete the two-phase commit process for the cluster synchronization that has been prepared.

Parameters:
id - id of the synchronization. Cannot be null
Throws:
IllegalStateException - if id is not equal to the id of an uncompleted synchronization started via #initiateSynchronization(SynchronizationId, List, RepsitoryContentMetadata, boolean)

rollbackSynchronization

void rollbackSynchronization(SynchronizationId<?> id)
Roll back the cluster synchronization.

Parameters:
id - id of the synchronization. Cannot be null
Throws:
IllegalStateException - if id is not equal to the id of an uncompleted synchronization started via #initiateSynchronization(SynchronizationId, List, RepsitoryContentMetadata, boolean)

createEmptyContentMetadata

RepositoryContentMetadata createEmptyContentMetadata()
Creates a new RepositoryContentMetadata with a child RepositoryRootMetadata for each of this persister's URIs, but no RepositoryItemMetadatas under those roots. When a node that is starting for the first time does not have a persisted set of content metadata, this method should be used to create an object that can be used as a base to generate a set of modifications needed to synchronize the node with the cluster.

Returns:
a RepositoryContentMetadata with no grandchildren.

installCurrentContentMetadata

void installCurrentContentMetadata()
Install the result from the latest call to getCurrentContentMetadata() as the "official" content metadata. Intended for use during node startup when the node discovers it is the only member of the cluster, and thus that it's "current" content metadata is "official".

Throws:
IllegalStateException - if no "current" content metadata is available, either because getCurrentContentMetadata() hasn't been called, or because a cluster synchronization has been executed to completion since that call.

getItemForAddition

RepositoryItemMetadata getItemForAddition(String vfsPath)
                                          throws IOException
Gets a RepositoryItemMetadata that will describe an item that may be added.

Parameters:
vfsPath - path relative to one of this repository's root URIs
Returns:
the item metadata
Throws:
IOException

getContentMetadataForAdd

RepositoryContentMetadata getContentMetadataForAdd(RepositoryItemMetadata toAdd,
                                                   InputStream contentIS)
                                                   throws IOException
Generate content metadata that would reflect what the metadata would look like if an item with path vfsPath were added.

Parameters:
vfsPath -
contentIS -
Returns:
Throws:
IOException

getVirtualFileForItem

org.jboss.virtual.VirtualFile getVirtualFileForItem(RepositoryItemMetadata item)
                                                    throws IOException
Get a VirtualFile for the content indicated by item.

Parameters:
item - metadata describing the content
Returns:
the virtual file
Throws:
IOException

getContentMetadataForRemove

RepositoryContentMetadata getContentMetadataForRemove(org.jboss.virtual.VirtualFile vf)
                                                      throws IOException
Generate content metadata that would reflect what the metadata would look like if an item with path vfsPath were removed.

Parameters:
vfsPath - path relative to one of this repository's root URIs
Returns:
the content metadata
Throws:
IOException


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