org.apache.jetspeed.services.registry
Class DatabaseRegistryService

java.lang.Object
  |
  +--org.apache.turbine.services.BaseInitable
        |
        +--org.apache.turbine.services.BaseService
              |
              +--org.apache.turbine.services.TurbineBaseService
                    |
                    +--org.apache.jetspeed.services.registry.DatabaseRegistryService
All Implemented Interfaces:
FileRegistry, org.apache.turbine.services.Initable, RegistryService, org.apache.turbine.services.Service

public class DatabaseRegistryService
extends org.apache.turbine.services.TurbineBaseService
implements RegistryService, FileRegistry

This is an implementation of the RegistryService based on the Jetspeed Database Persistence Manager

Version:
$Id: DatabaseRegistryService.java,v 1.6 2004/02/23 03:31:50 jford Exp $
Author:
David Sean Taylor, Suchisubhra Sinha

Field Summary
static int DEFAULT_VERBOSE
           
static java.lang.String SERVICE_NAME
          The name of this service
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.jetspeed.services.registry.FileRegistry
DEFAULT_REFRESH
 
Constructor Summary
DatabaseRegistryService()
           
 
Method Summary
 void addEntry(java.lang.String regName, org.apache.jetspeed.om.registry.RegistryEntry entry)
          Add a new RegistryEntry in the named Registry.
 org.apache.jetspeed.om.registry.RegistryEntry createEntry(java.lang.String regName)
          Creates a new RegistryEntry instance compatible with the current Registry instance implementation
 void createFragment(java.lang.String name, java.io.Reader reader, boolean persistent)
          Read and unmarshal a fragment in memory
 org.apache.jetspeed.om.registry.Registry get(java.lang.String regName)
          Returns a Registry object for further manipulation
 org.apache.jetspeed.om.registry.RegistryEntry getEntry(java.lang.String regName, java.lang.String entryName)
          Returns a RegistryEntry from the named Registry.
 java.util.Map getFragmentMap()
           
 java.util.Enumeration getNames()
          List all the registry currently available to this service
 void init()
          Late init method from Turbine Service model
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
 void loadFragment(java.lang.String file)
          Load and unmarshal a RegistryFragment from the file
 void refresh()
          Refresh the state of the registry implementation.
protected  void refresh(java.lang.String regName)
          Scan all the registry fragments for new entries relevant to this registry and update its definition.
 void removeEntry(java.lang.String regName, java.lang.String entryName)
          Deletes a RegistryEntry from the named Registry This is a convenience wrapper around Registry.removeEntry(org.apache.jetspeed.om.registry.RegistryEntry)
 void removeFragment(java.lang.String file)
          Remove a fragment from storage
 void saveFragment(java.lang.String file)
          Marshal and save a RegistryFragment to disk
 void shutdown()
          This is the shutdown method called by the Turbine Service framework
protected  void updateFragment(java.lang.String name, org.apache.jetspeed.services.registry.RegistryFragment fragment)
          Updates a fragment in storage and the associated entryIndex
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker
 

Field Detail

SERVICE_NAME

public static java.lang.String SERVICE_NAME
The name of this service


DEFAULT_VERBOSE

public static final int DEFAULT_VERBOSE
See Also:
Constant Field Values
Constructor Detail

DatabaseRegistryService

public DatabaseRegistryService()
Method Detail

get

public org.apache.jetspeed.om.registry.Registry get(java.lang.String regName)
Returns a Registry object for further manipulation

Specified by:
get in interface RegistryService
Parameters:
regName - the name of the registry to fetch
Returns:
a Registry object if found by the manager or null

getNames

public java.util.Enumeration getNames()
List all the registry currently available to this service

Specified by:
getNames in interface RegistryService
Returns:
an Enumeration of registry names.

createEntry

public org.apache.jetspeed.om.registry.RegistryEntry createEntry(java.lang.String regName)
Creates a new RegistryEntry instance compatible with the current Registry instance implementation

Specified by:
createEntry in interface RegistryService
Parameters:
regName - the name of the registry to use
Returns:
the newly created RegistryEntry

getEntry

public org.apache.jetspeed.om.registry.RegistryEntry getEntry(java.lang.String regName,
                                                              java.lang.String entryName)
Returns a RegistryEntry from the named Registry. This is a convenience wrapper around Registry.getEntry(java.lang.String)

Specified by:
getEntry in interface RegistryService
Parameters:
regName - the name of the registry
entryName - the name of the entry to retrieve from the registry.
Returns:
a RegistryEntry object if the key is found or null

addEntry

public void addEntry(java.lang.String regName,
                     org.apache.jetspeed.om.registry.RegistryEntry entry)
              throws RegistryException
Add a new RegistryEntry in the named Registry. This is a convenience wrapper around Registry.addEntry(org.apache.jetspeed.om.registry.RegistryEntry)

Specified by:
addEntry in interface RegistryService
Parameters:
regName - the name of the registry
entry - the Registry entry to add
Throws:
Sends - a RegistryException if the manager can't add the provided entry
RegistryException

removeEntry

public void removeEntry(java.lang.String regName,
                        java.lang.String entryName)
Deletes a RegistryEntry from the named Registry This is a convenience wrapper around Registry.removeEntry(org.apache.jetspeed.om.registry.RegistryEntry)

Specified by:
removeEntry in interface RegistryService
Parameters:
regName - the name of the registry
entryName - the name of the entry to remove

init

public void init(javax.servlet.ServletConfig conf)
          throws org.apache.turbine.services.InitializationException
This is the early initialization method called by the Turbine Service framework

Overrides:
init in class org.apache.turbine.services.TurbineBaseService
org.apache.turbine.services.InitializationException

getFragmentMap

public java.util.Map getFragmentMap()
Specified by:
getFragmentMap in interface FileRegistry
Returns:
a Map of all fragments keyed by file names

init

public void init()
          throws org.apache.turbine.services.InitializationException
Late init method from Turbine Service model

Specified by:
init in interface org.apache.turbine.services.Initable
Overrides:
init in class org.apache.turbine.services.TurbineBaseService
org.apache.turbine.services.InitializationException

shutdown

public void shutdown()
This is the shutdown method called by the Turbine Service framework

Specified by:
shutdown in interface org.apache.turbine.services.Initable
Overrides:
shutdown in class org.apache.turbine.services.TurbineBaseService

refresh

protected void refresh(java.lang.String regName)
Scan all the registry fragments for new entries relevant to this registry and update its definition.

Parameters:
regName - the name of the Registry to refresh

refresh

public void refresh()
Refresh the state of the registry implementation. Should be called whenever the underlying fragments are modified

Specified by:
refresh in interface FileRegistry

loadFragment

public void loadFragment(java.lang.String file)
Load and unmarshal a RegistryFragment from the file

Specified by:
loadFragment in interface FileRegistry
Parameters:
file - the absolute file path storing this fragment

createFragment

public void createFragment(java.lang.String name,
                           java.io.Reader reader,
                           boolean persistent)
Read and unmarshal a fragment in memory

Specified by:
createFragment in interface FileRegistry
Parameters:
name - the name of this fragment
persistent - whether this fragment should be persisted on disk in the registry
reader - the reader to use for creating this fragment

saveFragment

public void saveFragment(java.lang.String file)
Marshal and save a RegistryFragment to disk

Specified by:
saveFragment in interface FileRegistry
Parameters:
file - the absolute file path storing this fragment

removeFragment

public void removeFragment(java.lang.String file)
Remove a fragment from storage

Specified by:
removeFragment in interface FileRegistry
Parameters:
file - the absolute file path storing this fragment

updateFragment

protected void updateFragment(java.lang.String name,
                              org.apache.jetspeed.services.registry.RegistryFragment fragment)
Updates a fragment in storage and the associated entryIndex



Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.