org.apache.jetspeed.serializer
Class JetspeedSerializerImpl

java.lang.Object
  extended by org.apache.jetspeed.serializer.JetspeedSerializerBase
      extended by org.apache.jetspeed.serializer.JetspeedSerializerImpl
All Implemented Interfaces:
JetspeedSerializer

public class JetspeedSerializerImpl
extends JetspeedSerializerBase
implements JetspeedSerializer

Jetspeed Serializer

The Serializer is capable of reading and writing the current content of the Jetspeed environment to and from XML files. The component can be used from a standalone java application for seeding a new database or from a running portal as an administrative backup/restore function.

The XML file needs to indicate whether passwords used in credentials are plain text or whether they are encoded. The import algoritm can determine - prior to reading users - which encode/decode scheme was used and if or then we store plain passwords (Note that that alone requires the resulting XML to be encoded!!!!!)

Version:
$Id: $
Author:
Hajo Birthelmer

Field Summary
 
Fields inherited from class org.apache.jetspeed.serializer.JetspeedSerializerBase
log
 
Fields inherited from interface org.apache.jetspeed.serializer.JetspeedSerializer
DECODING_SUPPORTED, ERROR_DECODING, INVALID_PASSWORDS, KEY_BACKUP_BEFORE_PROCESS, KEY_OVERWRITE_EXISTING, KEY_PROCESS_CAPABILITIES, KEY_PROCESS_ENTITIES, KEY_PROCESS_PERMISSIONS, KEY_PROCESS_PORTAL_PREFERENCES, KEY_PROCESS_PREFERENCES, KEY_PROCESS_PROFILER, KEY_PROCESS_USER_PREFERENCES, KEY_PROCESS_USERS, NO_DECODING, PASSTHRU_REQUIRED, TAG_SECONDARYSNAPSHOT, TAG_SNAPSHOT
 
Constructor Summary
JetspeedSerializerImpl()
           
JetspeedSerializerImpl(ComponentManager cm)
          hand over existing component manager
JetspeedSerializerImpl(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  int compareCurrentSecurityProvider(JSSeedData file)
          Establish whether incoming passwords are "clear" text or whether they are to be decoded.
protected  java.lang.Class getSerializerDataClass()
          return the class for the serializer data , for example JSSeedData.class)
protected  java.lang.String getSerializerDataTag()
          return the XML tag for the serializer data , for example "JSSnapShot")
protected  void getSnapshotData()
          On import, get the basic SnapShot data
protected  void processExport(java.lang.String name, javolution.xml.XMLBinding binding)
          The workhorse for exporting data
protected  void processImport()
          The workhorse for importing data
protected  ProfilingRule recreateRule(Profiler profiler, ProfilingRule existingRule, JSProfilingRule jsp)
          recreate a profiling rule object from the deserialized wrapper and store it
protected  RuleCriterion recreateRuleCriterion(Profiler profiler, JSRuleCriterion jsr, ProfilingRule rule)
          recreate a rule criterion object from the deserialized wrapper
protected  void resetSettings()
          reset instruction flags to default settings (all true)
protected  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 org.apache.jetspeed.serializer.JetspeedSerializerBase
checkSettings, closeUp, createUniqueBackupFilename, doBackupOfCurrent, exportData, getCM, getDefaultIndent, getObjectBehindPath, getSetting, getSnapshot, getTokens, importData, initializeComponentManager, logMe, openWriter, readFile, recreatePassword, removeFromString, setComponentManager, setDefaultIndent, setSetting, setSnapshot, setSnapshotData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jetspeed.serializer.JetspeedSerializer
closeUp, exportData, getDefaultIndent, importData, initializeComponentManager, setComponentManager, setDefaultIndent
 

Constructor Detail

JetspeedSerializerImpl

public JetspeedSerializerImpl()

JetspeedSerializerImpl

public JetspeedSerializerImpl(ComponentManager cm)
hand over existing component manager

Parameters:
cm -

JetspeedSerializerImpl

public JetspeedSerializerImpl(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 JetspeedSerializerImpl("./", "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

getSerializerDataClass

protected java.lang.Class getSerializerDataClass()
Description copied from class: JetspeedSerializerBase
return the class for the serializer data , for example JSSeedData.class)

Specified by:
getSerializerDataClass in class JetspeedSerializerBase
Returns:

getSerializerDataTag

protected java.lang.String getSerializerDataTag()
Description copied from class: JetspeedSerializerBase
return the XML tag for the serializer data , for example "JSSnapShot")

Specified by:
getSerializerDataTag in class JetspeedSerializerBase
Returns:

resetSettings

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

Specified by:
resetSettings in class JetspeedSerializerBase

getSnapshotData

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

Overrides:
getSnapshotData in class JetspeedSerializerBase

processImport

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

Specified by:
processImport in class JetspeedSerializerBase
Parameters:
binding - established XML binding
Throws:
SerializerException

processExport

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

Specified by:
processExport in class JetspeedSerializerBase
Parameters:
binding - established XML binding
Throws:
SerializerException

setupAliases

protected 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

Specified by:
setupAliases in class JetspeedSerializerBase
Parameters:
binding -

compareCurrentSecurityProvider

protected int compareCurrentSecurityProvider(JSSeedData file)
Establish whether incoming passwords are "clear" text or whether they are to be decoded. That however depends on whether the passwords were encoded with the current active provider or not.

Returns:

recreateRuleCriterion

protected RuleCriterion recreateRuleCriterion(Profiler profiler,
                                              JSRuleCriterion jsr,
                                              ProfilingRule rule)
                                       throws SerializerException,
                                              java.lang.ClassNotFoundException
recreate a rule criterion object from the deserialized wrapper

Parameters:
profiler - established profile manager
jsr - deserialized object
Returns:
new RuleCriterion with content set to deserialized wrapepr
Throws:
SerializerException
java.lang.ClassNotFoundException

recreateRule

protected ProfilingRule recreateRule(Profiler profiler,
                                     ProfilingRule existingRule,
                                     JSProfilingRule jsp)
                              throws SerializerException,
                                     java.lang.ClassNotFoundException,
                                     ProfilerException
recreate a profiling rule object from the deserialized wrapper and store it

Parameters:
profiler - established profile manager
jsp - deserialized object
Throws:
SerializerException, - ClassNotFoundException, ProfilerException
SerializerException
java.lang.ClassNotFoundException
ProfilerException


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