SRJRCFrames
v0.1.296

de.schwarzrot.data.access.support
Class XMLExporter

java.lang.Object
  extended by de.schwarzrot.data.access.support.XMLBase
      extended by de.schwarzrot.data.access.support.XMLExporter
All Implemented Interfaces:
Exporter

public class XMLExporter
extends XMLBase
implements Exporter

class to export entities to xml files. Main purpose is to interchange data portions without having to care about id's or keys. Developed with the intention to ex- or import just themes and skins, it has now matured to serve as well to ex- and import complete database schemas.

Be aware, that writing of XML-files only works for persistent Entitys and will surely fail on other beans, as the XMLExporter only exports properties marked as persistent.

Another reason for writing my own exporter is the handling of entity relations, which now works without storing the id of an entity. This way imports won't fail, even if auto-increment keys are used and have different levels.

Author:
Reinhard Mantey
See Also:
EntityDescriptor

Field Summary
 
Fields inherited from class de.schwarzrot.data.access.support.XMLBase
EYECATCH, VA_ATTR, VA_CLASS, VA_ENTITY, VA_ENTRY, VA_ID, VA_ITEM, VA_KEY, VA_LIST, VA_MAIN, VA_MAP, VA_NAME, VA_REFID, VA_VALUE
 
Constructor Summary
XMLExporter()
           
 
Method Summary
protected  void export(List<?> valueList, String id, Map<String,Map<Long,Entity>> cache, Writer out)
           
protected  void export(Map<?,?> valueMap, String id, Map<String,Map<Long,Entity>> cache, Writer out)
           
protected  void export(Map<String,Map<Long,Entity>> cache, Writer out)
           
protected
<E extends Entity>
void
exportEntity(E instance, Map<String,Map<Long,Entity>> cache, Writer out)
           
protected
<E extends Entity>
void
exportForeigns(E instance, EntityDescriptor ed, Writer out)
           
protected
<E extends Entity>
void
exportNamedChildren(E instance, EntityDescriptor ed, Writer out)
           
protected
<E extends Entity>
void
exportProperty(E object, PropertyInfo pi, Writer out)
           
protected
<E extends Entity>
void
exportRelated(E instance, EntityDescriptor ed, Map<String,Map<Long,Entity>> cache, Writer out)
           
protected  void exportRelList(List<?> list, int indent, Writer out)
           
protected  void exportRelMap(String attrName, Map<?,?> map, EntityDescriptor ed, int indent, Writer out)
           
protected
<E extends Entity>
void
exportUnnamedChildren(E instance, EntityDescriptor ed, Writer out)
           
 EntityDescriptorAccessor getEntityDescriptorAccessor()
           
protected
<E extends Entity>
void
investigate(E instance, EntityDescriptor ed, Map<String,Map<Long,Entity>> cache, Map<String,PropertyInfo> relMap, Writer out)
           
protected
<E extends Entity>
Map<String,Map<Long,Entity>>
investigate(E instance, Map<String,Map<Long,Entity>> cache, Writer out)
           
protected  void investigate(List<?> lst, Map<String,Map<Long,Entity>> cache, Writer out)
           
protected  void investigate(Map<?,?> map, Map<String,Map<Long,Entity>> cache, Writer out)
           
<E extends Entity>
void
performExport(E instance, File target)
           
<E extends Entity>
void
performExport(E instance, Writer out)
          exports a single entity with all relations
 void performExport(List<?> lst, String id, File target)
           
 void performExport(List<?> lst, String id, Writer out)
          exports a list of entities
 void performExport(Map<?,?> map, String id, File target)
           
 void performExport(Map<?,?> map, String id, Writer out)
          exports a map of entities
 void setEntityDescriptorAccessor(EntityDescriptorAccessor i)
          injection method: sets the description accessor to access EntityDescriptions
 
Methods inherited from class de.schwarzrot.data.access.support.XMLBase
getLogger, loadClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLExporter

public XMLExporter()
Method Detail

getEntityDescriptorAccessor

public final EntityDescriptorAccessor getEntityDescriptorAccessor()

performExport

public <E extends Entity> void performExport(E instance,
                                             File target)
                   throws IOException
Throws:
IOException

performExport

public <E extends Entity> void performExport(E instance,
                                             Writer out)
                   throws IOException
Description copied from interface: Exporter
exports a single entity with all relations

Specified by:
performExport in interface Exporter
Type Parameters:
E - - class of entity
Parameters:
instance - - instance to export
out - - channel to write export data to
Throws:
IOException

performExport

public void performExport(List<?> lst,
                          String id,
                          File target)
                   throws IOException
Throws:
IOException

performExport

public void performExport(List<?> lst,
                          String id,
                          Writer out)
                   throws IOException
Description copied from interface: Exporter
exports a list of entities

Specified by:
performExport in interface Exporter
Parameters:
lst - - the list of entities to export
id - - used to name the list
out - - channel to write export data to
Throws:
IOException

performExport

public void performExport(Map<?,?> map,
                          String id,
                          File target)
                   throws IOException
Throws:
IOException

performExport

public void performExport(Map<?,?> map,
                          String id,
                          Writer out)
                   throws IOException
Description copied from interface: Exporter
exports a map of entities

Specified by:
performExport in interface Exporter
Parameters:
map - - the map of entities to export
id - - used to name the map
out - - channel to write export data to
Throws:
IOException

setEntityDescriptorAccessor

public final void setEntityDescriptorAccessor(EntityDescriptorAccessor i)
Description copied from interface: Exporter
injection method: sets the description accessor to access EntityDescriptions

Specified by:
setEntityDescriptorAccessor in interface Exporter
Parameters:
i - - the accessor to use

export

protected void export(List<?> valueList,
                      String id,
                      Map<String,Map<Long,Entity>> cache,
                      Writer out)
               throws IOException
Throws:
IOException

export

protected void export(Map<?,?> valueMap,
                      String id,
                      Map<String,Map<Long,Entity>> cache,
                      Writer out)
               throws IOException
Throws:
IOException

export

protected void export(Map<String,Map<Long,Entity>> cache,
                      Writer out)
               throws IOException
Throws:
IOException

exportEntity

protected <E extends Entity> void exportEntity(E instance,
                                               Map<String,Map<Long,Entity>> cache,
                                               Writer out)
                     throws IOException
Throws:
IOException

exportForeigns

protected <E extends Entity> void exportForeigns(E instance,
                                                 EntityDescriptor ed,
                                                 Writer out)
                       throws IOException
Throws:
IOException

exportNamedChildren

protected <E extends Entity> void exportNamedChildren(E instance,
                                                      EntityDescriptor ed,
                                                      Writer out)
                            throws IOException
Throws:
IOException

exportProperty

protected <E extends Entity> void exportProperty(E object,
                                                 PropertyInfo pi,
                                                 Writer out)
                       throws IOException
Throws:
IOException

exportRelated

protected <E extends Entity> void exportRelated(E instance,
                                                EntityDescriptor ed,
                                                Map<String,Map<Long,Entity>> cache,
                                                Writer out)
                      throws IOException
Throws:
IOException

exportRelList

protected void exportRelList(List<?> list,
                             int indent,
                             Writer out)
                      throws IOException
Throws:
IOException

exportRelMap

protected void exportRelMap(String attrName,
                            Map<?,?> map,
                            EntityDescriptor ed,
                            int indent,
                            Writer out)
                     throws IOException
Throws:
IOException

exportUnnamedChildren

protected <E extends Entity> void exportUnnamedChildren(E instance,
                                                        EntityDescriptor ed,
                                                        Writer out)
                              throws IOException
Throws:
IOException

investigate

protected <E extends Entity> void investigate(E instance,
                                              EntityDescriptor ed,
                                              Map<String,Map<Long,Entity>> cache,
                                              Map<String,PropertyInfo> relMap,
                                              Writer out)

investigate

protected <E extends Entity> Map<String,Map<Long,Entity>> investigate(E instance,
                                                                      Map<String,Map<Long,Entity>> cache,
                                                                      Writer out)

investigate

protected void investigate(List<?> lst,
                           Map<String,Map<Long,Entity>> cache,
                           Writer out)

investigate

protected void investigate(Map<?,?> map,
                           Map<String,Map<Long,Entity>> cache,
                           Writer out)

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.