COPYRIGHT org.osid.SidImplementationLicenseMIT
ALWAYS_PACKAGE comet.osidimpl.agent.sql
ALWAYS_MERGE_FROM agentImpl.merge

BEGIN
    CLASS AgentManager
    IMPLEMENTS org.osid.agent.AgentManager
    THROWS org.osid.agent.AgentException

    DECLARE private org.osid.sql.SqlManager sqlManager = null
    DECLARE private org.osid.id.IdManager idManager = null
    DECLARE private org.osid.logging.LoggingManager loggingManager = null
    DECLARE private org.osid.logging.WritableLog log = null
    
    DECLARE private org.osid.sql.Connection connection = null
    
    DECLARE private org.osid.OsidContext context = null
    DECLARE private java.util.Properties configuration = null
    DECLARE private java.util.Properties properties = new java.util.Properties()
    DECLARE private org.osid.shared.Type agentSearchType = new Type("mit.edu","search","directory")
    DECLARE private org.osid.shared.Type groupSearchType = new Type("mit.edu","search","display_name")
    
    METHOD public org.osid.OsidContext getOsidContext():return this.context
    METHOD public void assignOsidContext(org.osid.OsidContext context):this.context = context
    MERGE MergeAssignConfiguration:METHOD public void assignConfiguration(java.util.Properties configuration):this.configuration = configuration   
    METHOD public void osidVersion_2_0()    
    
    MERGE MergeTableToTypes:METHOD private java.util.Vector tableToTypes(org.osid.sql.ResultTable table)
    MERGE MergeLog:METHOD private void log(String entry)

    MERGE MergeCreateAgent:METHOD public org.osid.agent.Agent createAgent(String displayName, org.osid.shared.Type agentType, org.osid.shared.Properties properties)
    MERGE MergeDeleteAgent:METHOD public void deleteAgent(org.osid.shared.Id agentId)
    MERGE MergeGetAgent:METHOD public org.osid.agent.Agent getAgent(org.osid.shared.Id agentId)
    MERGE MergeGetAgents:METHOD public org.osid.agent.AgentIterator getAgents()
    MERGE MergeGetAgentTypes:METHOD public org.osid.shared.TypeIterator getAgentTypes()
    MERGE MergeCreateGroup:METHOD public org.osid.agent.Group createGroup(String displayName, org.osid.shared.Type groupType, String description, org.osid.shared.Properties properties)
    MERGE MergeDeleteGroup:METHOD public void deleteGroup(org.osid.shared.Id groupId)
/**
[Description_getGroup]
@param groupId
[@return_Group]
[@throws] OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR NULL_ARGUMENT, UNKNOWN_ID
*/
    MERGE MergeGetGroup:METHOD public org.osid.agent.Group getGroup(org.osid.shared.Id groupId)
/**
[Description_getGroups]
@return org.osid.agent.AgentIterator.  [Description_ReturnIterator]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeGetGroups:METHOD public org.osid.agent.AgentIterator getGroups()
/**
[Description_getGroupTypes]
@return org.osid.shared.TypeIterator.  [Description_ReturnIterator]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeGetGroupTypes:METHOD public org.osid.shared.TypeIterator getGroupTypes()
/**
[Description_getAgentsType]
@return org.osid.agent.AgentIterator
[@throws] OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED, NULL_ARGUMENT, UNKNOWN_TYPE
*/
    MERGE MergeGetAgentsType:METHOD org.osid.agent.AgentIterator getAgentsByType(org.osid.shared.Type agentType)
/**
[Description_getGroupsType]
@return org.osid.agent.AgentIterator
[@throws] OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED, NULL_ARGUMENT, UNKNOWN_TYPE
*/
    MERGE MergeGetGroupsType:METHOD public org.osid.agent.AgentIterator getGroupsByType(org.osid.shared.Type groupType)    
    MERGE MergeGetAgentsBySearch:METHOD public org.osid.agent.AgentIterator getAgentsBySearch(java.io.Serializable searchCriteria, org.osid.shared.Type agentSearchType)    
    MERGE MergeManagerGetGroupsBySearch:METHOD public org.osid.agent.AgentIterator getGroupsBySearch(java.io.Serializable searchCriteria, org.osid.shared.Type groupSearchType)    
    MERGE MergeManagerGetAgentSearchTypes:METHOD public org.osid.shared.TypeIterator getAgentSearchTypes()
    MERGE MergeManagerGetGroupSearchTypes:METHOD public org.osid.shared.TypeIterator getGroupSearchTypes()
    MERGE MergeManagerGetPropertySearchTypes:METHOD public org.osid.shared.TypeIterator getPropertyTypes()
END

BEGIN
/**
[Agent]
*/
    CLASS Agent
    IMPLEMENTS org.osid.agent.Agent    
    THROWS org.osid.agent.AgentException

    DECLARE private org.osid.shared.Id id = null
    DECLARE private String idString = null
    DECLARE private org.osid.id.IdManager idManager = null
    DECLARE private org.osid.logging.WritableLog log = null    
    DECLARE private org.osid.sql.Connection connection = null
    
    MERGE MergeTableToTypes:METHOD private java.util.Vector tableToTypes(org.osid.sql.ResultTable table)
    MERGE MergeLog:METHOD private void log(String entry)

    MERGE MergeAgentConstructor:METHOD protected Agent(org.osid.shared.Id id, String idString, org.osid.sql.Connection connection, org.osid.logging.WritableLog log, org.osid.id.IdManager idManager)
/**
[Description_getName] Agent. 
[@return_Name]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeAgentGetDisplayName:METHOD public String getDisplayName()   
/**
[Description_getId]
[@return_Id]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeAgentGetId:METHOD public org.osid.shared.Id getId()
/**
[Description_getType] Agent.
[@return_Type]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeAgentGetType:METHOD public org.osid.shared.Type getType()   
/**
[Description_getAgentProperties]
@return PropertiesIterator
[@throws] OPERATION_FAILED, CONFIGURATION_ERROR
*/
    MERGE MergeAgentGetProperties:METHOD org.osid.shared.PropertiesIterator getProperties()
/**
[Description_getAgentPropertiesType]
@return Properties
[@throws] OPERATION_FAILED, CONFIGURATION_ERROR, NULL_ARGUMENT, UNKNOWN_TYPE
*/
    MERGE MergeAgentGetPropertiesByType:METHOD org.osid.shared.Properties getPropertiesByType(org.osid.shared.Type propertiesType)
/**
[Description_getAgentPropertiesTypes]
@return org.osid.shared.TypeIterator
*/
    MERGE MergeAgentGetPropertyTypes:METHOD org.osid.shared.TypeIterator getPropertyTypes()
END

BEGIN
/**
[Group]
*/
    CLASS Group
    IMPLEMENTS org.osid.agent.Group
    THROWS org.osid.agent.AgentException

    DECLARE private org.osid.shared.Id id = null
    DECLARE private String idString = null
    DECLARE private org.osid.id.IdManager idManager = null
    DECLARE private org.osid.logging.WritableLog log = null    
    DECLARE private org.osid.sql.Connection connection = null

    MERGE MergeTableToTypes:METHOD private java.util.Vector tableToTypes(org.osid.sql.ResultTable table)
    MERGE MergeLog:METHOD private void log(String entry)

    MERGE MergeGroupConstructor:METHOD protected Group(org.osid.shared.Id id, String idString, org.osid.sql.Connection connection, org.osid.logging.WritableLog log, org.osid.id.IdManager idManager) 
/**
[Description_getName] Group. 
[@return_Name]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeGroupGetDisplayName:METHOD public String getDisplayName()   
/**
[Description_getName] Group. 
[@return_Description]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeGroupGetDescription:METHOD String getDescription()
/**
[Description_getId] Group.
[@return_Id]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeGroupGetId:METHOD public org.osid.shared.Id getId()
/**
[Description_getType] Group.
[@return_Type]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeGroupGetType:METHOD public org.osid.shared.Type getType()   
/**
[Description_updateDescription] Group.
@param description
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeGroupUpdateDescription:METHOD void updateDescription(String description)
/**
[Description_addMemberOrGroup]
@param memberOrGroup
[@throws] OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR NULL_ARGUMENT, ALREADY_ADDED
*/
    MERGE MergeGroupAdd:METHOD void add(org.osid.agent.Agent memberOrGroup)
/**
[Description_removeMemberOrGroup]
@param memberOrGroup
[@throws] OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR NULL_ARGUMENT
*/
    MERGE MergeGroupRemove:METHOD void remove(org.osid.agent.Agent memberOrGroup)
/**
[Description_getMembers]
@param includeSubgroups
@return AgentIterator.  [Description_ReturnIterator]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeGroupGetMembers:METHOD org.osid.agent.AgentIterator getMembers(boolean includeSubgroups)
/**
[Description_groupGetGroups]
@param includeSubgroups
@return AgentIterator.  [Description_ReturnIterator]
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    MERGE MergeGroupGetGroups:METHOD org.osid.agent.AgentIterator getGroups(boolean includeSubgroups)
/**
[Description_groupContains]
@param memberOrGroup
@param boolean searchSubgroups
@return boolean 
[@throws] OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR NULL_ARGUMENT
*/
    MERGE MergeGroupContainsMember:METHOD boolean contains(org.osid.agent.Agent memberOrGroup , boolean searchSubgroups)
/**
[Description_getPropertiesType]
@return PropertiesIterator
[@throws] UNIMPLEMENTED
*/
    MERGE MergeGroupGetProperties:METHOD org.osid.shared.PropertiesIterator getProperties()
/**
[Description_getAgentProperties]
@return Properties
[@throws] UNIMPLEMENTED
*/
    MERGE MergeGroupGetPropertiesByType:METHOD org.osid.shared.Properties getPropertiesByType(org.osid.shared.Type propertiesType)
/**
[Description_getAgentPropertiesTypes]
@return org.osid.shared.TypeIterator
[@throws] UNIMPLEMENTED
*/
    MERGE MergeGroupGetPropertyTypes:METHOD org.osid.shared.TypeIterator getPropertyTypes()
END

BEGIN
/**
AgentIterator [Description_AllIteratorInterfaces]
*/
    CLASS AgentIterator
    IMPLEMENTS org.osid.agent.AgentIterator
    THROWS org.osid.agent.AgentException

    DECLARE private java.util.Vector vector = new java.util.Vector()
    DECLARE private int i = 0
    CONSTRUCTOR java.util.Vector vector
    CONSTRUCTOR_LINE this.vector = vector
/**
[Description_IteratorHasNext1]Agents[Description_IteratorHasNext2]
@return boolean
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    METHOD boolean hasNextAgent():return i < vector.size()
/**
[Description_IteratorNext] Agent.
@return Agent
[@throws] OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR NO_MORE_ITERATOR_ELEMENTS 
*/
    MERGE MergeAgentIteratorNext:METHOD org.osid.agent.Agent nextAgent()
END

BEGIN
/**
TypeIterator [Description_AllIteratorInterfaces]
*/
    CLASS TypeIterator
    IMPLEMENTS org.osid.shared.TypeIterator
    THROWS org.osid.shared.SharedException

    DECLARE private java.util.Vector vector = new java.util.Vector()
    DECLARE private int i = 0
    CONSTRUCTOR java.util.Vector vector
    CONSTRUCTOR_LINE this.vector = vector
/**
[Description_IteratorHasNext1]Types[Description_IteratorHasNext2]
@return boolean
[@throws] OPERATION_FAILED, PERMISSION_DENIED
*/
    METHOD boolean hasNextType():return i < vector.size()
/**
[Description_IteratorNext] Type.
@return Agent
[@throws] OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR NO_MORE_ITERATOR_ELEMENTS 
*/
    MERGE MergeTypeIteratorNext:METHOD org.osid.shared.Type nextType()
END

BEGIN
    CLASS Type
    EXTENDS org.osid.shared.Type
    
    MERGE MergeTypeConstructor3:METHOD protected Type(String authority, String domain, String keyword)
    MERGE MergeTypeConstructor4:METHOD protected Type(String authority, String domain, String keyword, String description)
END

BEGIN
    CLASS SharedProperties
    IMPLEMENTS org.osid.shared.Properties
    THROWS org.osid.shared.SharedException
    
    DECLARE private java.util.Map map = new java.util.HashMap();
    DECLARE private org.osid.shared.Type type = new Type("mit.edu","shared","empty")

    METHOD public SharedProperties()
    MERGE MergePropertiesConstructor:METHOD public SharedProperties(java.util.Map map, org.osid.shared.Type type)
    MERGE MergePropertiesGetKeys:METHOD org.osid.shared.ObjectIterator getKeys()
    MERGE MergePropertiesGetProperty:METHOD java.io.Serializable getProperty(java.io.Serializable key)
    MERGE MergePropertiesGetType:METHOD org.osid.shared.Type getType()
END

BEGIN
    CLASS ObjectIterator
    IMPLEMENTS org.osid.shared.ObjectIterator
    THROWS org.osid.shared.SharedException
    
    DECLARE private java.util.Vector vector = new java.util.Vector()
    DECLARE private int i = 0
    CONSTRUCTOR java.util.Vector vector
    CONSTRUCTOR_LINE this.vector = vector

    METHOD boolean hasNextObject():return i < vector.size()
    MERGE MergeObjectIteratorNext:METHOD java.io.Serializable nextObject()
END

BEGIN
    CLASS SharedPropertiesIterator
    IMPLEMENTS org.osid.shared.PropertiesIterator
    THROWS org.osid.shared.SharedException

    DECLARE private java.util.Vector vector = new java.util.Vector()
    DECLARE private int i = 0
    CONSTRUCTOR java.util.Vector vector
    CONSTRUCTOR_LINE this.vector = vector

    METHOD boolean hasNextProperties():return i < vector.size()
    MERGE MergePropertiesIteratorNext:METHOD org.osid.shared.Properties nextProperties()
END
