edu.internet2.middleware.grouper.xml
Class XmlExporter

java.lang.Object
  extended by edu.internet2.middleware.grouper.xml.XmlExporter

public class XmlExporter
extends Object

Utility class for exporting data from the Groups Registry in XML format.

This class can export all-or-port of a Groups Registry as a stem/group hierarchy. Alternatively, collections of Stems, Groups, Subjects or Memberships may be exported.

Exported stem and group data may be imported, as is, or with modifications, into the same repository or into another repository. See XmlImporter.

The API for this class will change in future Grouper releases.

Since:
1.0
Version:
$Id: XmlExporter.java,v 1.17 2009-12-07 07:31:09 mchyzer Exp $
Author:
Gary Brown., blair christensen.

Constructor Summary
XmlExporter(GrouperSession s, Properties userOptions)
          Export the Groups Registry to XML.
 
Method Summary
 void export(Writer writer)
          Exports data for the entire repository

 void export(Writer writer, Collection items, String msg)
          Export a Collection of Stems, Groups, Members, Subjects or Memberships.
 void export(Writer writer, Group g, boolean relative, boolean includeParent)
          Export a single group.
 void export(Writer writer, Stem ns, boolean relative)
          Export a single stem.
 void export(Writer writer, Stem ns, boolean relative, boolean childrenOnly)
          Export a single stem.
 Properties internal_getOptions()
           
 String internal_groupToXML(Group g, boolean writeAbsoluteName)
          Return a String containing a Group as XML.
 String internal_membershipToXML(Membership ms)
          Return a String containing a Membership as XML.
 String internal_subjectToXML(edu.internet2.middleware.subject.Subject subj, String immediate)
          Return a String containing a Subject as XML.
static void main(String[] args)
          Export Groups Registry to XML output.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlExporter

public XmlExporter(GrouperSession s,
                   Properties userOptions)
            throws GrouperException
Export the Groups Registry to XML.

The export process is configured using the follow properties.

Key Values Default Value Description
export.metadata true/false true If true Group type and field information as well as Subject sources will be exported.
export.data true/false true If true data will be exported.
export.privs.naming true/false true If true naming privileges will be exported along with Stems.
export.privs.access true/false true If true access privileges will be exported along with Groups.
export.privs.immediate-only true/false false If true only directly granted privileges will be exported.
export.group.members true/false true If true group memberships are exported.
export.group.members.immediate-only true/false true If true only immediate group memberships will be exported.
export.group.lists true/false true If true custom list attributes will be exported.
export.group.lists.immediate-only true/false true If true only immediate list members will be exported.
export.uuids true/false true If true group and stem uuids will be exported
export.group.internal-attributes true/false true If true system-maintained Group attributes (eg. modifyDate) will be exported.
export.group.custom-attributes true/false true If true custom attributes will be exported.
export.stem.internal-attributes true/false true If true system-maintained Stem attributes (eg. modifyDate) will be exported.
export.privs.for-parents true/false false If true and only exporting a partial hierarchy then privileges for parent stems will be exported.
export.data.fail-on-unresolvable-subject true/false false If true and there is a problem resolving a subject attribute abort.
export.subject-attributes.source.<source name>.<subject type> Space separated list of attribute names ? Specifices any attributes that should be exported with a Subject given the specified Source and Subject Type.
export.subject-attributes.source.<source name> Space separated list of attribute names ? Specifies any attributes that should be exported with a Subject given the specified Source.
export.subject-attributes.type.<subject type> Space separated list of attribute names ? Specifies any attributes that should be exported with a Subject given the Subject Type.

Parameters:
s - Perform export within this session.
userOptions - User-specified configuration parameters.
Throws:
GrouperException
Since:
1.1.0
Method Detail

main

public static void main(String[] args)
Export Groups Registry to XML output.

Since:
1.1.0

export

public void export(Writer writer)
            throws GrouperException
Exports data for the entire repository

Parameters:
writer - Write XML here.
Throws:
GrouperException
Since:
1.1.0

export

public void export(Writer writer,
                   Group g,
                   boolean relative,
                   boolean includeParent)
            throws GrouperException
Export a single group.

Parameters:
writer - Write XML here.
g - Export this group.
relative - If true export in a format suitable for relocating within the Groups Registry.
includeParent - Include parent stem in export.
Throws:
GrouperException
Since:
1.1.0

export

public void export(Writer writer,
                   Stem ns,
                   boolean relative)
            throws GrouperException
Export a single stem.

Parameters:
writer - Write XML here.
ns - Export this stem.
relative - If true export in a format suitable for relocating within the Groups Registry.
Throws:
GrouperException
Since:
1.1.0

export

public void export(Writer writer,
                   Stem ns,
                   boolean relative,
                   boolean childrenOnly)
            throws GrouperException
Export a single stem.

Parameters:
writer - Write XML here.
ns - Export this stem.
relative - If true export in a format suitable for relocating within the Groups Registry.
childrenOnly - If true omit the actual stem and only export child stems/groups
Throws:
GrouperException
Since:
1.4.0

export

public void export(Writer writer,
                   Collection items,
                   String msg)
            throws GrouperException
Export a Collection of Stems, Groups, Members, Subjects or Memberships.

NOTE: XmlImporter cannot currently import the XML generated by this method.

Parameters:
writer - Write XML here.
items - Collection to export.
msg - Comment to indicate how collection was generated.
Throws:
GrouperException
Since:
1.1.0

internal_getOptions

public Properties internal_getOptions()

internal_groupToXML

public String internal_groupToXML(Group g,
                                  boolean writeAbsoluteName)
Return a String containing a Group as XML.

Since:
1.2.0

internal_membershipToXML

public String internal_membershipToXML(Membership ms)
                                throws GroupNotFoundException,
                                       MemberNotFoundException,
                                       edu.internet2.middleware.subject.SubjectNotFoundException
Return a String containing a Membership as XML.

Throws:
GroupNotFoundException
MemberNotFoundException
edu.internet2.middleware.subject.SubjectNotFoundException
Since:
1.2.0

internal_subjectToXML

public String internal_subjectToXML(edu.internet2.middleware.subject.Subject subj,
                                    String immediate)
Return a String containing a Subject as XML.

Since:
1.2.0