public class XmlImporter extends Object
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.
| Constructor and Description |
|---|
XmlImporter(GrouperSession s,
Properties userOptions)
Import the Groups Registry from XML.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public XmlImporter(GrouperSession s, Properties userOptions)
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. |
s - Perform import within this session.userOptions - User-specified configuration parameters.public static void main(String[] args)
args - args[0] = name of Xml file to processpublic void load(Document doc) throws GrouperException, IllegalArgumentException
try {
importer.load( XmlReader.getDocumentFromString(s) );
}
catch (GrouperException eG) {
// error importing
}
doc - Import this Document.GrouperExceptionIllegalArgumentException - if doc is nullpublic void load(Stem ns, Document doc) throws GrouperException, IllegalArgumentException
try {
importer.load( ns, XmlReader.getDocumentFromString(s) );
}
catch (GrouperException eG) {
// error importing
}
ns - Import using this Stem as the root stem.doc - Import this Document.GrouperExceptionIllegalArgumentException - if doc is nullpublic void update(Document doc) throws GrouperException, IllegalArgumentException
try {
importer.update( XmlReader.getDocumentFromString(s) );
}
catch (GrouperException eG) {
// error updating
}
doc - Import this Document.GrouperExceptionIllegalArgumentException - if doc is nullpublic void setIgnoreInternal(boolean ignoreInternal)
public Properties internal_getOptions()
public static void _handleArgs(XmlImporter importer, Properties rc) throws GrouperException
importer - rc - GrouperExceptionCopyright © 2016 Internet2. All rights reserved.