|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.system.server.profileservice.repository.clustered.local.AbstractLocalContentManager<T>
public abstract class AbstractLocalContentManager<T extends SynchronizationActionContext>
Abstract base class for a LocalContentManager
implementation.
Constructor Summary | |
---|---|
protected |
AbstractLocalContentManager(Map<String,URI> namedURIMap,
org.jboss.profileservice.spi.ProfileKey profileKey,
String localNodeName,
ContentMetadataPersister contentMetadataPersister)
Create a new AbstractLocalContentManager. |
Method Summary | |
---|---|
void |
commitSynchronization(SynchronizationId<?> id)
Complete the two-phase commit process for the cluster synchronization that has been prepared . |
protected abstract TwoPhaseCommitAction<T> |
createDirectoryTimestampMismatchAction(ContentModification mod,
boolean localLed)
Create an action to handle the local end of a node updating a directory timestamp to match the cluster. |
RepositoryContentMetadata |
createEmptyContentMetadata()
Creates a new RepositoryContentMetadata with a child
RepositoryRootMetadata for each of this persister's URIs,
but no RepositoryItemMetadata s under those roots. |
protected abstract TwoPhaseCommitAction<T> |
createMkdirFromClusterAction(ContentModification mod,
boolean localLed)
Create an action to handle the local end of a node adding a directory due to its presence on the cluster. |
protected abstract TwoPhaseCommitAction<T> |
createMkdirToClusterAction(ContentModification mod,
boolean localLed)
Create an action to handle the local end of a node adding a directory to the cluster. |
protected abstract TwoPhaseCommitAction<T> |
createPrepareRmdirFromClusterAction(ContentModification mod,
boolean localLed)
|
protected abstract TwoPhaseCommitAction<T> |
createPrepareRmdirToClusterAction(ContentModification mod,
boolean localLed)
Create an action to handle the local end of a node removing a directory from the cluster. |
protected abstract TwoPhaseCommitAction<T> |
createPullFromClusterAction(ContentModification mod,
boolean localLed)
Create an action to handle the local end of a node pulling content from the cluster. |
protected abstract TwoPhaseCommitAction<T> |
createPushStreamToClusterAction(ContentModification mod,
InputStream stream)
Create an action to handle the local end of a node pushing content that is read from an external-to-the-repository stream to the cluster. |
protected abstract TwoPhaseCommitAction<T> |
createPushToClusterAction(ContentModification mod,
boolean localLed)
Create an action to handle the local end of a node pushing content to the cluster. |
protected abstract TwoPhaseCommitAction<T> |
createRemoveFromClusterAction(ContentModification mod,
boolean localLed)
Create an action to handle the local end of a node removing content that the rest of the cluster regards as invalid. |
protected abstract TwoPhaseCommitAction<T> |
createRemoveToClusterAction(ContentModification mod,
boolean localLed)
Create an action to handle the local end of a node removing content from the cluster. |
protected static String |
createStoreName(org.jboss.profileservice.spi.ProfileKey key)
|
protected abstract T |
createSynchronizationActionContext(SynchronizationId<?> id,
RepositoryContentMetadata toUpdate)
Create a SynchronizationActionContext for the given cluster-wide
content synchronization. |
protected org.jboss.virtual.VirtualFile |
getCachedVirtualFile(URI uri)
Gets a VirtualFile corresponding to the given URI. |
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. |
String |
getLocalNodeName()
|
RepositoryContentMetadata |
getOfficialContentMetadata()
Gets the "official" record of the contents of the persistent store. |
protected URI |
getRootURIForModification(ContentModification mod)
Gets the URI of the repository root with which the given modification is associated. |
String |
getStoreName()
|
protected T |
getSynchronizationActionContext()
Gets the current SynchronizationActionContext . |
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 LocalContentManager.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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractLocalContentManager(Map<String,URI> namedURIMap, org.jboss.profileservice.spi.ProfileKey profileKey, String localNodeName, ContentMetadataPersister contentMetadataPersister)
namedURIMap
- Map of URIs managed by this object, keyed by a
String identifierprofileKey
- key of the profile the content of which this
object is managinglocalNodeName
- name of the local node in the clustercontentMetadataPersister
- object to use for storing/retrieving content metadataMethod Detail |
---|
protected static String createStoreName(org.jboss.profileservice.spi.ProfileKey key)
public String getLocalNodeName()
public String getStoreName()
public RepositoryContentMetadata getOfficialContentMetadata()
LocalContentManager
getOfficialContentMetadata
in interface LocalContentManager<T extends SynchronizationActionContext>
public RepositoryContentMetadata createEmptyContentMetadata()
LocalContentManager
RepositoryContentMetadata
with a child
RepositoryRootMetadata
for each of this persister's URIs,
but no RepositoryItemMetadata
s 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.
createEmptyContentMetadata
in interface LocalContentManager<T extends SynchronizationActionContext>
RepositoryContentMetadata
with no grandchildren.public RepositoryContentMetadata getCurrentContentMetadata() throws IOException
LocalContentManager
official version
have not been synchronized with the cluster.
getCurrentContentMetadata
in interface LocalContentManager<T extends SynchronizationActionContext>
IOException
public List<? extends SynchronizationAction<T>> initiateSynchronization(SynchronizationId<?> id, List<ContentModification> modifications, RepositoryContentMetadata toInstall, boolean localLed)
LocalContentManager
initiateSynchronization
in interface LocalContentManager<T extends SynchronizationActionContext>
id
- a unique id for this cluster synchronization processmodifications
- the overall list of modifications that will occur during
this processtoInstall
- TODOlocalLed
- true
if this node is driving the synchronization,
false
if another node is
SynchronizationAction
s each of which
can be executed by the caller to fulfill a portion of this node's role in
the overall cluster synchronizationpublic boolean prepareSynchronization(SynchronizationId<?> id)
LocalContentManager
initialized
.
prepareSynchronization
in interface LocalContentManager<T extends SynchronizationActionContext>
id
- id of the synchronization. Cannot be null
true
if the prepare phase was successful;
false
if not and the synchronization needs to be
rolled backpublic void commitSynchronization(SynchronizationId<?> id)
LocalContentManager
prepared
.
commitSynchronization
in interface LocalContentManager<T extends SynchronizationActionContext>
id
- id of the synchronization. Cannot be null
public void rollbackSynchronization(SynchronizationId<?> id)
LocalContentManager
rollbackSynchronization
in interface LocalContentManager<T extends SynchronizationActionContext>
id
- id of the synchronization. Cannot be null
public void installCurrentContentMetadata()
LocalContentManager
LocalContentManager.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".
installCurrentContentMetadata
in interface LocalContentManager<T extends SynchronizationActionContext>
public RepositoryItemMetadata getItemForAddition(String vfsPath) throws IOException
LocalContentManager
RepositoryItemMetadata
that will describe an item that
may be added.
getItemForAddition
in interface LocalContentManager<T extends SynchronizationActionContext>
vfsPath
- path relative to one of this repository's root URIs
IOException
public RepositoryContentMetadata getContentMetadataForAdd(RepositoryItemMetadata toAdd, InputStream contentIS) throws IOException
LocalContentManager
getContentMetadataForAdd
in interface LocalContentManager<T extends SynchronizationActionContext>
IOException
public org.jboss.virtual.VirtualFile getVirtualFileForItem(RepositoryItemMetadata item) throws IOException
LocalContentManager
VirtualFile
for the content indicated by item
.
getVirtualFileForItem
in interface LocalContentManager<T extends SynchronizationActionContext>
item
- metadata describing the content
IOException
public RepositoryContentMetadata getContentMetadataForRemove(org.jboss.virtual.VirtualFile vf) throws IOException
LocalContentManager
getContentMetadataForRemove
in interface LocalContentManager<T extends SynchronizationActionContext>
IOException
protected abstract T createSynchronizationActionContext(SynchronizationId<?> id, RepositoryContentMetadata toUpdate)
SynchronizationActionContext
for the given cluster-wide
content synchronization.
id
- the id of the synchronizationtoUpdate
- metadata object that should be updated as synchronization
actions are performed.protected abstract TwoPhaseCommitAction<T> createPullFromClusterAction(ContentModification mod, boolean localLed)
mod
- object describing the content modification this action is
part oflocalLed
- true
if this node is driving the synchronization
process the action is part of; false
if
another node is
null
.protected abstract TwoPhaseCommitAction<T> createPushToClusterAction(ContentModification mod, boolean localLed)
mod
- object describing the content modification this action is
part oflocalLed
- true
if this node is driving the synchronization
process the action is part of; false
if
another node is
null
.protected abstract TwoPhaseCommitAction<T> createPushStreamToClusterAction(ContentModification mod, InputStream stream)
DeploymentRepository.addDeployment(String, org.jboss.profileservice.spi.ProfileDeployment)
.
This is only invoked on the node that is driving the synchronization process.
mod
- object describing the content modification this action is
part ofstream
- the stream from which content will be read.
null
.protected abstract TwoPhaseCommitAction<T> createRemoveFromClusterAction(ContentModification mod, boolean localLed)
mod
- object describing the content modification this action is
part oflocalLed
- true
if this node is driving the synchronization
process the action is part of; false
if
another node is
null
.protected abstract TwoPhaseCommitAction<T> createRemoveToClusterAction(ContentModification mod, boolean localLed)
mod
- object describing the content modification this action is
part oflocalLed
- true
if this node is driving the synchronization
process the action is part of; false
if
another node is
null
.protected abstract TwoPhaseCommitAction<T> createPrepareRmdirToClusterAction(ContentModification mod, boolean localLed)
mod
- object describing the content modification this action is
part oflocalLed
- true
if this node is driving the synchronization
process the action is part of; false
if
another node is
null
.protected abstract TwoPhaseCommitAction<T> createPrepareRmdirFromClusterAction(ContentModification mod, boolean localLed)
protected abstract TwoPhaseCommitAction<T> createMkdirToClusterAction(ContentModification mod, boolean localLed)
mod
- object describing the content modification this action is
part oflocalLed
- true
if this node is driving the synchronization
process the action is part of; false
if
another node is
null
.protected abstract TwoPhaseCommitAction<T> createMkdirFromClusterAction(ContentModification mod, boolean localLed)
mod
- object describing the content modification this action is
part oflocalLed
- true
if this node is driving the synchronization
process the action is part of; false
if
another node is
null
.protected abstract TwoPhaseCommitAction<T> createDirectoryTimestampMismatchAction(ContentModification mod, boolean localLed)
mod
- object describing the content modification this action is
part oflocalLed
- true
if this node is driving the synchronization
process the action is part of; false
if
another node is
null
.protected T getSynchronizationActionContext()
SynchronizationActionContext
.
null
if there isn't oneprotected org.jboss.virtual.VirtualFile getCachedVirtualFile(URI uri) throws IOException
VirtualFile
corresponding to the given URI.
uri
- the uri. Cannot be null
.
IOException
NullPointerException
- if uri
is null
.protected URI getRootURIForModification(ContentModification mod)
mod
- the modification. Cannot be null
null
if the modification is for
an unknown root
NullPointerException
- if uri
is null
.ContentModification.getRootName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |