Skip to Content.
Sympa Menu

grouper-dev - XML import/export

Subject: Grouper Developers Forum

List archive

XML import/export


Chronological Thread 
  • From: "GW Brown, Information Systems and Computing" <>
  • To:
  • Subject: XML import/export
  • Date: Wed, 08 Mar 2006 13:25:12 +0000

I have attached two xml files. Using a new XmlImporter class I loaded import.xml into an empty repository (empty apart from QuickStart subjects). I then used a new class, XmlExporter, to export the entire repository to export1.xml.

The exported data has extra information (most of which can be turned off by setting options appropriately). <internalAttributes> are never imported.

I don't export privileges for GrouperSystem, but I do for GrouperAll.

The format has changed from the QuickStart format to allow for custom fields. I haven't tested yet, but the old format should still work for import.

There are options for specifying whether to export effective members / privilegees - these would be ignored by an import.

displayExtension / description and custom attributes are updated for existing stems / groups. I'll probably make this an option also.

Additional members / privilegees will be added. I intend to define an attribute to specify whether existing lists should be replaced, left alone, or new subjects only added.

You can do a relative export (stem or an individual group). Any export can be loaded at any existing stem - though it is possible a relative export may reference a group which is not exported and does not exist in a repository where the data is loaded. I intend to log missing 'subjects' including groups rather than fail.

Tom has suggested a package:
edu.internet2.middleware.grouper.interfaces.xml
for the new classes.

Gary


----------------------
GW Brown, Information Systems and Computing
<?xml version="1.0" encoding="UTF-8"?>
<registry>
  <metadata>
    <groupTypesMetaData>

      <groupType name='committee'>

       <field name='enforcer'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

      </groupType>

      <groupType name='teaching'>

       <field name='clerical'
               required='false'
               type='list'
               readPriv='read'
               writePriv='update'/>

       <field name='faculty_code'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

       <field name='org_code'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

       <field name='staff'
               required='false'
               type='list'
               readPriv='read'
               writePriv='update'/>

      </groupType>

      <groupType name='mailingList'>

       <field name='alias'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

      </groupType>


      <groupType name='community'>

       <field name='contributors'
               required='true'
               type='list'
               readPriv='read'
               writePriv='update'/>

       <field name='scope'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

      </groupType>
      </groupTypesMetaData>


    <subjectSourceMetaData>

      <source id='g:gsa'
              name='Grouper: Group Source Adapter'
              class='edu.internet2.middleware.grouper.GrouperSourceAdapter'>
        <subjectType name='group'/>
      </source>

      <source id='g:isa'
              name='Grouper: Internal Source Adapter'
              class='edu.internet2.middleware.grouper.InternalSourceAdapter'>
        <subjectType name='application'/>
      </source>

      <source id='jdbc'
              name='JDBC Source Adapter'
              class='edu.internet2.middleware.subject.provider.JDBCSourceAdapter'>
        <subjectType name='person'/>
      </source>

    </subjectSourceMetaData>

  </metadata>
  <data>


      <path extension='qsuobimp'
            displayExtension='UoB test'>

      <privileges type='stem'>
        <subject identifier='qsuobimp:admins' type='group' source='g:gsa' immediate='true' />
      </privileges> 

      <privileges type='create'>
        <subject identifier='.:admins' type='group' source='g:gsa' immediate='true' />
      </privileges>


          <group extension='admins'
                 displayExtension='UoB admins'>

            <list field='members'  groupType='base'>
              <subject identifier='elwi' type='person' source='jdbc' immediate='true' />
              <subject identifier='kebe' type='person' source='jdbc' immediate='true' />
            </list> <!--/field=members-->

          <privileges type='admin'>
            <subject identifier='*SELF*' type='group' source='g:gsa' immediate='true' />
          </privileges> 

          </group>



        <path extension='sslf'
              displayExtension='Social Sciences and Law'>

        <privileges type='stem'>
          <subject identifier='..:admins' type='group' source='g:gsa' immediate='true' />
          <subject identifier='.:admins' type='group' source='g:gsa' immediate='true' />
        </privileges> 

        <privileges type='create'>
          <subject identifier='..:admins' type='group' source='g:gsa' immediate='true' />
          <subject identifier='.:admins' type='group' source='g:gsa' immediate='true' />
        </privileges>


          <group extension='students'
                 displayExtension='Students'>

            <groupTypes>
              <groupType name='teaching'>
                <attribute name='faculty_code'>SSLF</attribute>
                <attribute name='org_code'>SSLF</attribute>
                </groupType>
            </groupTypes>

            <list field='members'  groupType='base'>
              <subject identifier='jawi' type='person' source='jdbc' immediate='true' />
              <subject identifier='jata' type='person' source='jdbc' immediate='true' />
              <subject identifier='japo' type='person' source='jdbc' immediate='true' />
              <subject identifier='jabe' type='person' source='jdbc' immediate='true' />
              <subject identifier='jato' type='person' source='jdbc' immediate='true' />
              <subject identifier='jado' type='person' source='jdbc' immediate='true' />
              <subject identifier='jama' type='person' source='jdbc' immediate='true' />
              <subject identifier='jaed' type='person' source='jdbc' immediate='true' />
              <subject identifier='jabu' type='person' source='jdbc' immediate='true' />
              <subject identifier='jabr' type='person' source='jdbc' immediate='true' />
              <subject identifier='jaco' type='person' source='jdbc' immediate='true' />
              <subject identifier='jabl' type='person' source='jdbc' immediate='true' />
            </list> 
            
			<list field='clerical'  groupType='teaching'>
              <subject identifier='kewi' type='person' source='jdbc' immediate='true' />
              <subject identifier='fita' type='person' source='jdbc' immediate='true' />
            </list> 
            
            <list field='staff'  groupType='teaching'>
             <subject identifier='..:staff' type='group' source='g:gsa' immediate='true' />
            </list> 

          <privileges type='admin'>
            <subject identifier='..:..:admins' type='group' source='g:gsa' immediate='true' />
            <subject identifier='..:admins' type='group' source='g:gsa' immediate='true' />
          </privileges> 

          <privileges type='read'>
            <subject identifier='*SELF*' type='group' source='g:gsa' immediate='true' />
          </privileges> 

          </group>




          <group extension='staff'
                 displayExtension='Staff'>

            <list field='members'  groupType='base' mode='replace|missing|ignore'>
              <subject identifier='stwi' type='person' source='jdbc' immediate='true' />
              <subject identifier='stta' type='person' source='jdbc' immediate='true' />
            </list> 

          <privileges type='admin'>
            <subject identifier='..:..:admins' type='group' source='g:gsa' immediate='true' />
            <subject identifier='..:admins' type='group' source='g:gsa' immediate='true' />
          </privileges>

          <privileges type='read'>
            <subject identifier='..:students' type='group' source='g:gsa' immediate='true' />
          </privileges> 

          </group>



  
          <group extension='admins'
                 displayExtension='Administrators'>

            <list field='members'  groupType='base'>
              <subject identifier='stwi' type='person' source='jdbc' immediate='true' />
            </list> 

          <privileges type='admin'>
            <subject identifier='..:..:admins' type='group' source='g:gsa' immediate='true' />
            <subject identifier='*SELF*' type='group' source='g:gsa' immediate='true' />
          </privileges> 

          <privileges type='read'>
            <subject identifier='..:staff' type='group' source='g:gsa' immediate='true' />
          </privileges> 

          </group>
         

        </path>
      
        </path>
  </data>

 
</registry>
<?xml version="1.0" encoding="UTF-8"?>
<registry>
  <metadata>
    <groupTypesMetaData>

      <groupType name='committee'>

       <field name='enforcer'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

      </groupType>

      <groupType name='teaching'>

       <field name='clerical'
               required='false'
               type='list'
               readPriv='read'
               writePriv='update'/>

       <field name='faculty_code'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

       <field name='org_code'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

       <field name='staff'
               required='false'
               type='list'
               readPriv='read'
               writePriv='update'/>

      </groupType>

      <groupType name='mailingList'>

       <field name='alias'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

      </groupType>

      <groupType name='community'>

       <field name='contributors'
               required='true'
               type='list'
               readPriv='read'
               writePriv='update'/>

       <field name='scope'
               required='false'
               type='attribute'
               readPriv='read'
               writePriv='update'/>

      </groupType>
      </groupTypesMetaData>


    <subjectSourceMetaData>

      <source id='g:gsa'
              name='Grouper: Group Source Adapter'
              class='edu.internet2.middleware.grouper.GrouperSourceAdapter'>
        <subjectType name='group'/>
      </source>

      <source id='g:isa'
              name='Grouper: Internal Source Adapter'
              class='edu.internet2.middleware.grouper.InternalSourceAdapter'>
        <subjectType name='application'/>
      </source>

      <source id='jdbc'
              name='JDBC Source Adapter'
              class='edu.internet2.middleware.subject.provider.JDBCSourceAdapter'>
        <subjectType name='person'/>
      </source>

    </subjectSourceMetaData>

  </metadata>
  <data>

      <!--qsuobimp-->
      <path extension='qsuobimp'
            displayExtension='UoB test'>

      <privileges type='stem'>
        <subject identifier='qsuobimp:admins' type='group' source='g:gsa' immediate='true' />
      </privileges> <!--/privilege=stem-->

      <privileges type='create'>
        <subject identifier='qsuobimp:admins' type='group' source='g:gsa' immediate='true' />
      </privileges> <!--/privilege=create-->

        <!--qsuobimp:sslf-->
        <path extension='sslf'
              displayExtension='Social Sciences and Law'>

        <privileges type='stem'>
          <subject identifier='qsuobimp:admins' type='group' source='g:gsa' immediate='true' />
          <subject identifier='qsuobimp:sslf:admins' type='group' source='g:gsa' immediate='true' />
        </privileges> <!--/privilege=stem-->

        <privileges type='create'>
          <subject identifier='qsuobimp:admins' type='group' source='g:gsa' immediate='true' />
          <subject identifier='qsuobimp:sslf:admins' type='group' source='g:gsa' immediate='true' />
        </privileges> <!--/privilege=create-->

          <!--qsuobimp:sslf:students-->
          <group extension='students'
                 displayExtension='Students'>

            <internalAttributes>
              <attribute name='uuid'>40123c83-8c3d-4739-a9ba-f7043dc5467a</attribute>
              <attribute name='parentStem'>qsuobimp:sslf</attribute>
              <attribute name='createSource'></attribute>
              <attribute name='createSubject'>
              <subject identifier='GrouperSystem' type='application' source='g:isa'/>
              </attribute>
              <attribute name='createTime'>Wed Mar 08 13:06:54 GMT 2006</attribute>
              <attribute name='modifySource'></attribute>
              <attribute name='modifySubject'>
                <subject identifier='GrouperSystem' type='application' source='g:isa'/>
              <attribute name='modifyTime'>Wed Mar 08 13:07:02 GMT 2006</attribute>
              </attribute>
            </internalAttributes>

            <groupTypes>
              <groupType name='base'>
                <attribute name='displayName'>UoB test:Social Sciences and Law:Students</attribute>
                <attribute name='name'>qsuobimp:sslf:students</attribute>
                </groupType>
              <groupType name='teaching'>
                </groupType>
            </groupTypes>

            <list field='members'  groupType='base'>
              <subject identifier='jawi' type='person' source='jdbc' immediate='true' />
              <subject identifier='jata' type='person' source='jdbc' immediate='true' />
              <subject identifier='japo' type='person' source='jdbc' immediate='true' />
              <subject identifier='jabe' type='person' source='jdbc' immediate='true' />
              <subject identifier='jato' type='person' source='jdbc' immediate='true' />
              <subject identifier='jado' type='person' source='jdbc' immediate='true' />
              <subject identifier='jama' type='person' source='jdbc' immediate='true' />
              <subject identifier='jaed' type='person' source='jdbc' immediate='true' />
              <subject identifier='jabu' type='person' source='jdbc' immediate='true' />
              <subject identifier='jabr' type='person' source='jdbc' immediate='true' />
              <subject identifier='jaco' type='person' source='jdbc' immediate='true' />
              <subject identifier='jabl' type='person' source='jdbc' immediate='true' />
            </list> <!--/field=members-->

            <list field='clerical'  groupType='teaching'>
              <subject identifier='kewi' type='person' source='jdbc' immediate='true' />
              <subject identifier='fita' type='person' source='jdbc' immediate='true' />
            </list> <!--/field=clerical-->

            <list field='staff'  groupType='teaching'>
              <subject identifier='qsuobimp:sslf:staff' type='group' source='g:gsa' immediate='true' />
            </list> <!--/field=staff-->

          <privileges type='admin'>
            <subject identifier='qsuobimp:admins' type='group' source='g:gsa' immediate='true' />
            <subject identifier='qsuobimp:sslf:admins' type='group' source='g:gsa' immediate='true' />
          </privileges> <!--/privilege=admin-->

          <privileges type='read'>
            <subject identifier='GrouperAll' type='application' source='g:isa' immediate='true' />
            <subject identifier='qsuobimp:sslf:students' type='group' source='g:gsa' immediate='true' />
          </privileges> <!--/privilege=read-->

          <privileges type='view'>
            <subject identifier='GrouperAll' type='application' source='g:isa' immediate='true' />
          </privileges> <!--/privilege=view-->

          </group>
          <!--/qsuobimp:sslf:students-->


          <!--qsuobimp:sslf:admins-->
          <group extension='admins'
                 displayExtension='Administrators'>

            <internalAttributes>
              <attribute name='uuid'>c8090fbf-910b-42fd-b5fe-e1430cc2df52</attribute>
              <attribute name='parentStem'>qsuobimp:sslf</attribute>
              <attribute name='createSource'></attribute>
              <attribute name='createSubject'>
              <subject identifier='GrouperSystem' type='application' source='g:isa'/>
              </attribute>
              <attribute name='createTime'>Wed Mar 08 13:06:54 GMT 2006</attribute>
              <attribute name='modifySource'></attribute>
              <attribute name='modifySubject'>
                <subject identifier='GrouperSystem' type='application' source='g:isa'/>
              <attribute name='modifyTime'>Wed Mar 08 13:07:03 GMT 2006</attribute>
              </attribute>
            </internalAttributes>

            <groupTypes>
              <groupType name='base'>
                <attribute name='displayName'>UoB test:Social Sciences and Law:Administrators</attribute>
                <attribute name='name'>qsuobimp:sslf:admins</attribute>
                </groupType>
            </groupTypes>

            <list field='members'  groupType='base'>
              <subject identifier='stwi' type='person' source='jdbc' immediate='true' />
            </list> <!--/field=members-->

          <privileges type='admin'>
            <subject identifier='qsuobimp:admins' type='group' source='g:gsa' immediate='true' />
            <subject identifier='qsuobimp:sslf:admins' type='group' source='g:gsa' immediate='true' />
          </privileges> <!--/privilege=admin-->

          <privileges type='read'>
            <subject identifier='GrouperAll' type='application' source='g:isa' immediate='true' />
            <subject identifier='qsuobimp:sslf:staff' type='group' source='g:gsa' immediate='true' />
          </privileges> <!--/privilege=read-->

          <privileges type='view'>
            <subject identifier='GrouperAll' type='application' source='g:isa' immediate='true' />
          </privileges> <!--/privilege=view-->

          </group>
          <!--/qsuobimp:sslf:admins-->


          <!--qsuobimp:sslf:staff-->
          <group extension='staff'
                 displayExtension='Staff'>

            <internalAttributes>
              <attribute name='uuid'>924a8206-033a-4cb9-a2c2-99c2d532e57e</attribute>
              <attribute name='parentStem'>qsuobimp:sslf</attribute>
              <attribute name='createSource'></attribute>
              <attribute name='createSubject'>
              <subject identifier='GrouperSystem' type='application' source='g:isa'/>
              </attribute>
              <attribute name='createTime'>Wed Mar 08 13:06:54 GMT 2006</attribute>
              <attribute name='modifySource'></attribute>
              <attribute name='modifySubject'>
                <subject identifier='GrouperSystem' type='application' source='g:isa'/>
              <attribute name='modifyTime'>Wed Mar 08 13:07:03 GMT 2006</attribute>
              </attribute>
            </internalAttributes>

            <groupTypes>
              <groupType name='base'>
                <attribute name='displayName'>UoB test:Social Sciences and Law:Staff</attribute>
                <attribute name='name'>qsuobimp:sslf:staff</attribute>
                </groupType>
            </groupTypes>

            <list field='members'  groupType='base'>
              <subject identifier='stwi' type='person' source='jdbc' immediate='true' />
              <subject identifier='stta' type='person' source='jdbc' immediate='true' />
            </list> <!--/field=members-->

          <privileges type='admin'>
            <subject identifier='qsuobimp:admins' type='group' source='g:gsa' immediate='true' />
            <subject identifier='qsuobimp:sslf:admins' type='group' source='g:gsa' immediate='true' />
          </privileges> <!--/privilege=admin-->

          <privileges type='read'>
            <subject identifier='GrouperAll' type='application' source='g:isa' immediate='true' />
            <subject identifier='qsuobimp:sslf:students' type='group' source='g:gsa' immediate='true' />
          </privileges> <!--/privilege=read-->

          <privileges type='view'>
            <subject identifier='GrouperAll' type='application' source='g:isa' immediate='true' />
          </privileges> <!--/privilege=view-->

          </group>
          <!--/qsuobimp:sslf:staff-->

        </path>
        <!--/qsuobimp:sslf-->


        <!--qsuobimp:admins-->
        <group extension='admins'
               displayExtension='UoB admins'>

          <internalAttributes>
            <attribute name='uuid'>f8e9764b-bf4d-426d-91a5-579475af2dd1</attribute>
            <attribute name='parentStem'>qsuobimp</attribute>
            <attribute name='createSource'></attribute>
            <attribute name='createSubject'>
            <subject identifier='GrouperSystem' type='application' source='g:isa'/>
            </attribute>
            <attribute name='createTime'>Wed Mar 08 13:06:55 GMT 2006</attribute>
            <attribute name='modifySource'></attribute>
            <attribute name='modifySubject'>
              <subject identifier='GrouperSystem' type='application' source='g:isa'/>
            <attribute name='modifyTime'>Wed Mar 08 13:07:04 GMT 2006</attribute>
            </attribute>
          </internalAttributes>

          <groupTypes>
            <groupType name='base'>
              <attribute name='displayName'>UoB test:UoB admins</attribute>
              <attribute name='name'>qsuobimp:admins</attribute>
              </groupType>
          </groupTypes>

          <list field='members'  groupType='base'>
            <subject identifier='elwi' type='person' source='jdbc' immediate='true' />
            <subject identifier='kebe' type='person' source='jdbc' immediate='true' />
          </list> <!--/field=members-->

        <privileges type='admin'>
          <subject identifier='qsuobimp:admins' type='group' source='g:gsa' immediate='true' />
        </privileges> <!--/privilege=admin-->

        <privileges type='read'>
          <subject identifier='GrouperAll' type='application' source='g:isa' immediate='true' />
        </privileges> <!--/privilege=read-->

        <privileges type='view'>
          <subject identifier='GrouperAll' type='application' source='g:isa' immediate='true' />
        </privileges> <!--/privilege=view-->

        </group>
        <!--/qsuobimp:admins-->

      </path>
      <!--/qsuobimp-->

  </data>

  <exportInfo>
    <start>Wed Mar 08 13:08:29 GMT 2006</start>
    <end>Wed Mar 08 13:08:33 GMT 2006</end>
    <duration>4</duration>
    <node type='stem'></node>
    <relative>true</relative>
    <includeParent>false</includeParent>
    <options>
      <option key='export.metadata'>true</option>
      <option key='export.privs.immediate-only'>true</option>
      <option key='export.group.lists'>true</option>
      <option key='export.privs.access'>true</option>
      <option key='export.group.internal-attributes'>true</option>
      <option key='export.group.members.immediate-only'>true</option>
      <option key='export.data'>true</option>
      <option key='export.group.lists.immediate-only'>true</option>
      <option key='export.group.members'>true</option>
      <option key='export.privs.naming'>true</option>
      <option key='export.privs.for-parents'>true</option>
    </options>
  </exportInfo>
</registry>


  • XML import/export, GW Brown, Information Systems and Computing, 03/08/2006

Archive powered by MHonArc 2.6.16.

Top of Page