org.apache.jetspeed.serializer
Class JetspeedSerializerBase

java.lang.Object
  extended by org.apache.jetspeed.serializer.JetspeedSerializerBase
Direct Known Subclasses:
JetspeedSerializerImpl, JetspeedSerializerSecondaryImpl

public abstract class JetspeedSerializerBase
extends java.lang.Object


Field Summary
protected static org.apache.commons.logging.Log log
          Logger
 
Constructor Summary
JetspeedSerializerBase()
           
JetspeedSerializerBase(ComponentManager cm)
          hand over existing component manager
JetspeedSerializerBase(java.lang.String appRoot, java.lang.String[] bootConfig, java.lang.String[] appConfig)
          This constructor takes the application root, the search path for the boot component configuration files and the search path for the application component configuration files.
 
Method Summary
protected  void checkSettings(java.util.Map settings)
          set instruction flags to new settings
 void closeUp()
           
protected  java.lang.String createUniqueBackupFilename(java.lang.String name)
          Helper routine to create a unique filename for a backup of an existing filename....not intended to be rocket science...
protected  void doBackupOfCurrent(java.lang.String importFileName, java.util.Map currentSettings)
          create a backup of the current environment in case the import fails
 void exportData(java.lang.String name, java.lang.String exportFileName, java.util.Map settings)
           
protected  ComponentManager getCM()
           
 java.lang.String getDefaultIndent()
           
protected  java.lang.Object getObjectBehindPath(java.util.Map map, java.lang.String _fullPath)
          simple lookup for object from a map
protected abstract  java.lang.Class getSerializerDataClass()
          return the class for the serializer data , for example JSSeedData.class)
protected abstract  java.lang.String getSerializerDataTag()
          return the XML tag for the serializer data , for example "JSSnapShot")
 boolean getSetting(java.lang.String key)
          returns the key for a particular process setting.
 JSSnapshot getSnapshot()
           
protected  void getSnapshotData()
          On import, get the basic SnapShot data
protected  java.util.ArrayList getTokens(java.lang.String _line)
          convert a list of elements in a string, seperated by ',' into an arraylist of strings
 void importData(java.lang.String importFileName, java.util.Map settings)
           
 void initializeComponentManager(java.lang.String appRoot, java.lang.String[] bootConfig, java.lang.String[] appConfig)
           
protected  void logMe(java.lang.String text)
          just a Simple helper to make code more readable
protected  javolution.xml.XMLObjectWriter openWriter(java.lang.String filename)
          create or open a given file for writing
protected abstract  void processExport(java.lang.String name, javolution.xml.XMLBinding binding)
          The workhorse for exporting data
protected abstract  void processImport()
          The workhorse for importing data
protected  JSSnapshot readFile(java.lang.String importFileName, javolution.xml.XMLBinding binding)
          read a snapshot and return the reconstructed class tree
protected  java.lang.String recreatePassword(char[] savedPassword)
           
protected  java.lang.String removeFromString(java.lang.String base, java.lang.String excess)
          remove a given sequence from the beginning of a string
protected abstract  void resetSettings()
          reset instruction flags to default settings (all true)
 void setComponentManager(ComponentManager cm)
           
 void setDefaultIndent(java.lang.String indent)
           
protected  void setSetting(java.lang.String key, boolean value)
          set a process setting for a given key
 void setSnapshot(JSSnapshot snapshot)
           
protected  void setSnapshotData()
          On export, set the basic SnapShot data
protected abstract  void setupAliases(javolution.xml.XMLBinding binding)
          Setup the binding for the different classes, mapping each extracted class to a unique tag name in the XML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
Logger

Constructor Detail

JetspeedSerializerBase

public JetspeedSerializerBase()

JetspeedSerializerBase

public JetspeedSerializerBase(ComponentManager cm)
hand over existing component manager

Parameters:
cm -

JetspeedSerializerBase

public JetspeedSerializerBase(java.lang.String appRoot,
                              java.lang.String[] bootConfig,
                              java.lang.String[] appConfig)
                       throws SerializerException
This constructor takes the application root, the search path for the boot component configuration files and the search path for the application component configuration files.

For example: new JetspeedSerializerSecondaryImpl("./", "assembly/boot/*.xml", "assembly/*.xml") will establish the current directory as the root, process all xml files in the assembly/boot directory before processing all xml files in the assembly directory itself.

Parameters:
appRoot - working directory
bootConfig - boot (primary) file or files (wildcards are allowed)
appConfig - application (secondary) file or files (wildcards are allowed)
Throws:
SerializerException
Method Detail

getCM

protected final ComponentManager getCM()

initializeComponentManager

public final void initializeComponentManager(java.lang.String appRoot,
                                             java.lang.String[] bootConfig,
                                             java.lang.String[] appConfig)
                                      throws SerializerException
Throws:
SerializerException

setComponentManager

public final void setComponentManager(ComponentManager cm)

closeUp

public final void closeUp()

setDefaultIndent

public final void setDefaultIndent(java.lang.String indent)

getDefaultIndent

public final java.lang.String getDefaultIndent()

importData

public final void importData(java.lang.String importFileName,
                             java.util.Map settings)
                      throws SerializerException
Throws:
SerializerException

exportData

public final void exportData(java.lang.String name,
                             java.lang.String exportFileName,
                             java.util.Map settings)
                      throws SerializerException
Throws:
SerializerException

doBackupOfCurrent

protected final void doBackupOfCurrent(java.lang.String importFileName,
                                       java.util.Map currentSettings)
create a backup of the current environment in case the import fails


readFile

protected final JSSnapshot readFile(java.lang.String importFileName,
                                    javolution.xml.XMLBinding binding)
                             throws SerializerException
read a snapshot and return the reconstructed class tree

Parameters:
importFileName -
Throws:
SerializerException

openWriter

protected final javolution.xml.XMLObjectWriter openWriter(java.lang.String filename)
                                                   throws SerializerException
create or open a given file for writing

Throws:
SerializerException

getSetting

public final boolean getSetting(java.lang.String key)
returns the key for a particular process setting. False if the key doesn't exist.

Parameters:
key -
Returns:

setSetting

protected final void setSetting(java.lang.String key,
                                boolean value)
set a process setting for a given key

Parameters:
key - instruction to set
value - true or false

checkSettings

protected final void checkSettings(java.util.Map settings)
set instruction flags to new settings

Parameters:
settings -

getSnapshotData

protected void getSnapshotData()
On import, get the basic SnapShot data


setSnapshotData

protected void setSnapshotData()
On export, set the basic SnapShot data


getObjectBehindPath

protected final java.lang.Object getObjectBehindPath(java.util.Map map,
                                                     java.lang.String _fullPath)
simple lookup for object from a map

Parameters:
map -
_fullPath -
Returns:

removeFromString

protected final java.lang.String removeFromString(java.lang.String base,
                                                  java.lang.String excess)
remove a given sequence from the beginning of a string


logMe

protected final void logMe(java.lang.String text)
just a Simple helper to make code more readable

Parameters:
text -

createUniqueBackupFilename

protected final java.lang.String createUniqueBackupFilename(java.lang.String name)
Helper routine to create a unique filename for a backup of an existing filename....not intended to be rocket science...

Parameters:
name -
Returns:

getTokens

protected final java.util.ArrayList getTokens(java.lang.String _line)
convert a list of elements in a string, seperated by ',' into an arraylist of strings

Parameters:
_line - Strinbg containing one or more elements seperated by ','
Returns:
list of elements of null

recreatePassword

protected final java.lang.String recreatePassword(char[] savedPassword)

resetSettings

protected abstract void resetSettings()
reset instruction flags to default settings (all true)


processExport

protected abstract void processExport(java.lang.String name,
                                      javolution.xml.XMLBinding binding)
                               throws SerializerException
The workhorse for exporting data

Parameters:
binding - established XML binding
Throws:
SerializerException

processImport

protected abstract void processImport()
                               throws SerializerException
The workhorse for importing data

Parameters:
binding - established XML binding
Throws:
SerializerException

setupAliases

protected abstract void setupAliases(javolution.xml.XMLBinding binding)
Setup the binding for the different classes, mapping each extracted class to a unique tag name in the XML

Parameters:
binding -

getSerializerDataClass

protected abstract java.lang.Class getSerializerDataClass()
return the class for the serializer data , for example JSSeedData.class)

Returns:

getSerializerDataTag

protected abstract java.lang.String getSerializerDataTag()
return the XML tag for the serializer data , for example "JSSnapShot")

Returns:

getSnapshot

public JSSnapshot getSnapshot()

setSnapshot

public void setSnapshot(JSSnapshot snapshot)


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.