com.ados.hestia.utils.db
Class KeyProcessor

java.lang.Object
  extended by com.ados.hestia.utils.db.KeyProcessor
Direct Known Subclasses:
PartnerInfoProcessor, PartnerLocationProcessor, RevisionProcessor, SecurityInfoProcessor, ServerOptionsProcessor, SessionProcessor, TPAProcessor

public abstract class KeyProcessor
extends Object

Helper class which provide support of IStore and Containers.

Version:
$Revision: 1726 $ $Date: 2006-03-30 19:51:44 +0900 $
See Also:
IStore, Container

Field Summary
protected  KeyDescriptor m_descriptor
           
protected static HestiaLogger m_log
           
protected  long m_modification
           
protected  Processor m_processor
           
protected  Properties m_properties
           
protected  StoreRepository m_repository
           
 
Constructor Summary
protected KeyProcessor(StoreRepository repository, Properties properties, KeyDescriptor descriptor)
          Constructor.
 
Method Summary
 void close()
          Close processor.
protected static void closeSafe(Object stream)
          Safely close output or input stream.
protected  void closeStore(IStore store)
          Close store by deleting it from StoreRepository.
protected  IStore containerToTempStore(Container container)
          Serialize container to temporary store.
protected static void errorToCollectorError(Throwable e)
          Convert common error to CollectorException.
protected  Container getContainerFromProcessor(String id)
          Extract Container with specific id from processor.
 long getModificationStatus()
          Returns current revision of processor's entries.
 Processor getProcessor()
          Returns processor.
protected  StoreRepository getRepository()
          Return reference to StoreRepository to support access to IStore.
protected  void updateModification()
          Update modification status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_processor

protected Processor m_processor

m_descriptor

protected KeyDescriptor m_descriptor

m_repository

protected StoreRepository m_repository

m_properties

protected Properties m_properties

m_modification

protected long m_modification

m_log

protected static HestiaLogger m_log
Constructor Detail

KeyProcessor

protected KeyProcessor(StoreRepository repository,
                       Properties properties,
                       KeyDescriptor descriptor)
Constructor.

Parameters:
repository - specify working StoreRepository for IStore access.
properties - connection properties to specific database.
descriptor - provide information how data is stored ad database.
Method Detail

getModificationStatus

public long getModificationStatus()
Returns current revision of processor's entries. Each change increase status by 1.

Returns:
current revision of processor's entries. Each change increase status by 1.

updateModification

protected void updateModification()
Update modification status.


close

public void close()
Close processor. Ensure that corresponded db processor is closed.


getProcessor

public Processor getProcessor()
Returns processor. Create it if needed.

Returns:
processor. Create it if needed.

errorToCollectorError

protected static void errorToCollectorError(Throwable e)
                                     throws CollectorException
Convert common error to CollectorException.

Parameters:
e - common error to convert.
Throws:
CollectorException - always throw.

closeSafe

protected static void closeSafe(Object stream)
Safely close output or input stream. Ignore IOException on close.

Parameters:
stream - stream to close.

getRepository

protected StoreRepository getRepository()
Return reference to StoreRepository to support access to IStore.

Returns:
reference to StoreRepository to support access to IStore.

containerToTempStore

protected IStore containerToTempStore(Container container)
                               throws CollectorException
Serialize container to temporary store.

Parameters:
container - container to serialize.
Returns:
store wich keep container.
Throws:
CollectorException - if container cannot be serialized to store.

closeStore

protected void closeStore(IStore store)
Close store by deleting it from StoreRepository.

Parameters:
store - specify store to close.

getContainerFromProcessor

protected Container getContainerFromProcessor(String id)
                                       throws CollectorException
Extract Container with specific id from processor.

Parameters:
id - specify id of contaner to extract.
Returns:
Container with specific id from.
Throws:
CollectorException - if Container cannot be extracted from database.


Copyright © 2005-2006 ADOS Co.,Ltd.. All Rights Reserved.