edu.internet2.middleware.grouper.ui.util
Class MembershipImportManager

java.lang.Object
  extended by edu.internet2.middleware.grouper.ui.util.MembershipImportManager
All Implemented Interfaces:
Serializable

public class MembershipImportManager
extends Object
implements Serializable

Class that reads an XML configuration file and hands off actual data import to an implementation associated with the selected import format. The configuration file is determined by looking up the media.properties key 'membership-import.config'. The base Grouper UI distribution does not have a value set. If you want to allow membership import you must configure one or more formats appropriate to your site.

<membership-import>
    <format name="Tab separated" separator="\t" id-field="1"  field-type="id"
               ignore-existing="true" 
               class="edu.internet2.middleware.grouper.ui.util.DefaultMembershipImporter"/>
    <format name="Comma separated" separator="," id-field="1"  field-type="id"
               ignore-existing="true" 
               class="edu.internet2.middleware.grouper.ui.util.DefaultMembershipImporter"/>
</membership-import>  

ignore-existing=true indicates that no error should be reported if an imported Subject is already a member of the group
class specifies the implementation for this format
name is the text that users will see and select - unless there is only one format, in which case it will be used as a default.

Other attributes are interpreted by the implementation class. There is no formal DTD/Schema.

Version:
$Id: MembershipImportManager.java,v 1.6 2009-10-16 10:30:08 isgwb Exp $
Author:
Gary Brown.
See Also:
Serialized Form

Constructor Summary
MembershipImportManager()
           
 
Method Summary
 List getAvailableFormats()
          Returns the configured import formats
 boolean isActive()
          Returns true if the XML configuration file exists and there is at least one import format defined.
 int load(String format, Group group, Reader input, PrintWriter output, Field field)
          Looks up the configuration for the supplied format, instantiates the configured implemetation class and calls its 'load' method
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MembershipImportManager

public MembershipImportManager()
                        throws Exception
Parameters:
config - - media.properties. The key 'membership-import.config' defines XML configuratoin file
nav - - nav.properties. Provides localized messages
Throws:
Exception
Method Detail

isActive

public boolean isActive()
Returns true if the XML configuration file exists and there is at least one import format defined.

Returns:
whether the UI should present import controls

getAvailableFormats

public List getAvailableFormats()
                         throws Exception
Returns the configured import formats

Returns:
list of import format names
Throws:
Exception

load

public int load(String format,
                Group group,
                Reader input,
                PrintWriter output,
                Field field)
         throws Exception,
                IOException,
                SchemaException
Looks up the configuration for the supplied format, instantiates the configured implemetation class and calls its 'load' method

Parameters:
format -
group -
input -
output -
field -
Returns:
count of errors encountered during the load
Throws:
IOException
SchemaException
Exception