org.jboss.system.server.profileservice.repository.clustered.local
Class AbstractContentMetadataPersister

java.lang.Object
  extended by org.jboss.system.server.profileservice.repository.clustered.local.AbstractContentMetadataPersister
All Implemented Interfaces:
ContentMetadataPersister
Direct Known Subclasses:
JAXBRepositoryContentMetadataPersister

public abstract class AbstractContentMetadataPersister
extends Object
implements ContentMetadataPersister

Abstract base class for a ContentMetadataPersister.

Author:
Brian Stansberry

Constructor Summary
AbstractContentMetadataPersister(File dir)
          Create a new AbstractContentMetadataPersister.
 
Method Summary
protected  File getContentMetadataDir()
          Get the base directory where content metadata is to be stored.
abstract  File getMetadataPath(String storeName)
          Get the file where metadata is stored.
 RepositoryContentMetadata load(String baseName)
          Load content metadata from the persistent store.
protected abstract  RepositoryContentMetadata loadMetadata(File metadataStore)
          Actually load the metadata
protected abstract  void saveMetadata(File metadataStore, RepositoryContentMetadata metadata)
          Actually store the given metadata.
 void store(String baseName, RepositoryContentMetadata metadata)
          Store content metadata to the persistent store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractContentMetadataPersister

public AbstractContentMetadataPersister(File dir)
Create a new AbstractContentMetadataPersister.

Parameters:
dir - directory in which content metadata should be persisted. Cannot be null.
Method Detail

load

public RepositoryContentMetadata load(String baseName)
Description copied from interface: ContentMetadataPersister
Load content metadata from the persistent store.

Specified by:
load in interface ContentMetadataPersister
Parameters:
baseName - name of the store. Cannot be null
Returns:
the metadata

store

public void store(String baseName,
                  RepositoryContentMetadata metadata)
Description copied from interface: ContentMetadataPersister
Store content metadata to the persistent store.

Specified by:
store in interface ContentMetadataPersister
Parameters:
baseName - name of the store. Cannot be null
metadata - the metadata. Cannot be null

getMetadataPath

public abstract File getMetadataPath(String storeName)
Get the file where metadata is stored.

Parameters:
storeName - the name of the store; identifies which metadata is desired
Returns:
the file. Will not be null

loadMetadata

protected abstract RepositoryContentMetadata loadMetadata(File metadataStore)
                                                   throws Exception
Actually load the metadata

Parameters:
metadataStore - file where metadata is stored
Returns:
the metadata
Throws:
Exception

saveMetadata

protected abstract void saveMetadata(File metadataStore,
                                     RepositoryContentMetadata metadata)
                              throws Exception
Actually store the given metadata.

Parameters:
metadataStore - file where metadata should be stored. Cannot be null
metadata - the metadata. Cannot be null
Throws:
Exception

getContentMetadataDir

protected File getContentMetadataDir()
Get the base directory where content metadata is to be stored.

Returns:
the directory. Will not be null.


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