edu.internet2.middleware.grouper.xml
Class XmlImporter

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

public class XmlImporter
extends Object

Utility class for importing data in XML import into the Groups Registry.

This class reads an XML file representing all or part of a Groups Registry and updates-or-creates the equivalent Stems, Groups and Memberships. This class can be used to load data exported by XmlExporter.

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

Since:
1.0
Version:
$Id: XmlImporter.java,v 1.24.2.2 2009-12-18 21:03:44 tzeller Exp $
Author:
Gary Brown., blair christensen.

Constructor Summary
XmlImporter(GrouperSession s, Properties userOptions)
          Import the Groups Registry from XML.
 
Method Summary
static void _handleArgs(XmlImporter importer, Properties rc)
           
 Properties internal_getOptions()
           
 void load(Document doc)
          Populate Groups Registry.
 void load(Stem ns, Document doc)
          Populate Groups Registry using the specified Stem as the root of the registry.
static void main(String[] args)
          Process an Xml file as the 'root' user.
 void setIgnoreInternal(boolean ignoreInternal)
           
 void update(Document doc)
          Update memberships and privileges but do not create missing stems or groups.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlImporter

public XmlImporter(GrouperSession s,
                   Properties userOptions)
Import the Groups Registry from XML.

The import process is configured through the following properties.

Key Values Default Description
import.metadata.group-types true/false true If true create custom group types when importing.
import.metadata.group-type-attributes true/false true If true create custom fields when importing.
import.data.ignore-internal-attributes-and-uuids=false true/false false If true, do not attempt to set internal attributes or Group/Stem uuids
import.data.apply-new-group-types true/false true If true custom group types are applied to pre-existing groups when importing.
import.data.update-attributes true/false true If true overwrite attributes on pre-existing groups when importing.
import.data.fail-on-unresolvable-subject true/false false If true, and the import file references a subject which cannot be resolved abort the import, otherwise, log the problem and continue.
import.data.lists ignore/replace/add replace Determines whether membership lists are ignored, replaced or appended to pre-existing memberships when importing.
import.data.privileges ignore/replace/add add Determines whether privileges are ignored, replaced or appended to pre-existing privileges when importing.

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

main

public static void main(String[] args)
Process an Xml file as the 'root' user.

Parameters:
args - args[0] = name of Xml file to process
Since:
1.1.0

load

public void load(Document doc)
          throws GrouperException,
                 IllegalArgumentException
Populate Groups Registry.
 try {
   importer.load( XmlReader.getDocumentFromString(s) );
 }
 catch (GrouperException eG) {
   // error importing
 }
 

Parameters:
doc - Import this Document.
Throws:
GrouperException
IllegalArgumentException - if doc is null
Since:
1.1.0

load

public void load(Stem ns,
                 Document doc)
          throws GrouperException,
                 IllegalArgumentException
Populate Groups Registry using the specified Stem as the root of the registry.
 try {
   importer.load( ns, XmlReader.getDocumentFromString(s) );
 }
 catch (GrouperException eG) {
   // error importing
 }
 

Parameters:
ns - Import using this Stem as the root stem.
doc - Import this Document.
Throws:
GrouperException
IllegalArgumentException - if doc is null
Since:
1.1.0

update

public void update(Document doc)
            throws GrouperException,
                   IllegalArgumentException
Update memberships and privileges but do not create missing stems or groups.
 try {
   importer.update( XmlReader.getDocumentFromString(s) );
 }
 catch (GrouperException eG) {
   // error updating
 }
 

Parameters:
doc - Import this Document.
Throws:
GrouperException
IllegalArgumentException - if doc is null
Since:
1.1.0

setIgnoreInternal

public void setIgnoreInternal(boolean ignoreInternal)

internal_getOptions

public Properties internal_getOptions()

_handleArgs

public static void _handleArgs(XmlImporter importer,
                               Properties rc)
                        throws GrouperException
Parameters:
importer -
rc -
Throws:
GrouperException
Since:
1.1.0