org.eclipse.higgins.idas.impl
Class IBasicResource

Package class diagram package IBasicResource
java.lang.Object
  extended by org.eclipse.higgins.idas.impl.IBasicResource
All Implemented Interfaces:
IEntity, IHasMetadata, IResource

public class IBasicResource
extends Object
implements IResource


Constructor Summary
IBasicResource(String name, String type)
           
IBasicResource(String name, String type, Iterable<BasicAttribute> attrs)
           
IBasicResource(String name, String type, Vector<BasicAttribute> attrs)
           
 
Method Summary
 void addAttribute(IAttribute attribute)
           
 void addMetadata(IMetadata metadata)
           
 IAttribute createAttribute(URI type, IPropertyValue value)
          Creates and adds an attribute for this Entity.
 IAttribute createAttribute(URI type, Iterable<IPropertyValue> values)
          Creates and adds an attribute for this Entity.
 IMetadata createMetadata(URI type, IPropertyValue value)
          Creates a metadata item which can be added to metadata held by this Object.
 IAttribute getAttribute(URI attrID)
          Return specified attribute of this Entity
 Iterable<IAttribute> getAttributes()
          Return all attributes of this Entity
 Iterable<IMetadata> getMetadataSet()
          Returns this Object's metadata elements as an Iterable.
 String getName()
           
 String getType()
          Returns the type of this Entity.
As all Entities are required to have a type attribute, this is a shortcut for calling getAttribute("<URI of type attrID>").
 void removeAttribute(IAttribute attribute)
           
 void removeMetadata(IMetadata metadata)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IBasicResource

public IBasicResource(String name,
                      String type)

IBasicResource

public IBasicResource(String name,
                      String type,
                      Iterable<BasicAttribute> attrs)

IBasicResource

public IBasicResource(String name,
                      String type,
                      Vector<BasicAttribute> attrs)
Method Detail

getName

public String getName()
               throws IdASException
Specified by:
getName in interface IEntity
Throws:
IdASException

getType

public String getType()
               throws IdASException
Description copied from interface: IEntity
Returns the type of this Entity.
As all Entities are required to have a type attribute, this is a shortcut for calling getAttribute("<URI of type attrID>"). TODO: The above comment presumes we have a higgins-defined attribute type called "type". Do we need this? TODO: We decided to make the type be a String rather than URI -- need to remember why, and document it.

Specified by:
getType in interface IEntity
Returns:
The type of this Entity.
Throws:
IdASException

createAttribute

public IAttribute createAttribute(URI type,
                                  IPropertyValue value)
                           throws IdASException
Description copied from interface: IEntity
Creates and adds an attribute for this Entity.

Specified by:
createAttribute in interface IEntity
Parameters:
type - The attribute's type.
value - The attribute's value.
Returns:
The resulting Attribute.
Throws:
IdASException

createAttribute

public IAttribute createAttribute(URI type,
                                  Iterable<IPropertyValue> values)
                           throws IdASException
Description copied from interface: IEntity
Creates and adds an attribute for this Entity.

Specified by:
createAttribute in interface IEntity
Parameters:
type - The attribute's type.
values - The attribute's values.
Returns:
The resulting Attribute.
Throws:
IdASException

addAttribute

public void addAttribute(IAttribute attribute)
                  throws IdASException
Specified by:
addAttribute in interface IEntity
Throws:
IdASException

removeAttribute

public void removeAttribute(IAttribute attribute)
                     throws IdASException
Specified by:
removeAttribute in interface IEntity
Throws:
IdASException

getAttributes

public Iterable<IAttribute> getAttributes()
                                   throws IdASException
Description copied from interface: IEntity
Return all attributes of this Entity

Specified by:
getAttributes in interface IEntity
Returns:
An Iterable object of IAttributes.
Throws:
IdASException

getAttribute

public IAttribute getAttribute(URI attrID)
                        throws IdASException
Description copied from interface: IEntity
Return specified attribute of this Entity

Specified by:
getAttribute in interface IEntity
Parameters:
attrID - The identifier of the attribute to be returned.
Returns:
An IAttribute or null if none exits.
Throws:
IdASException

createMetadata

public IMetadata createMetadata(URI type,
                                IPropertyValue value)
                         throws IdASException
Description copied from interface: IHasMetadata
Creates a metadata item which can be added to metadata held by this Object.

Specified by:
createMetadata in interface IHasMetadata
Parameters:
type - The type of metadata. This defines the datatype of the value.
value - The value of this metadata. The type of this is determined by the type arg.
Returns:
The created metadata item.
Throws:
IdASException - TODO: Specify whether this also adds the produced IMetadata to this Object, or if addItem must subsequently be called.

TODO: If this method also adds, note that updates to the returned IMetadata affect the added item (i.e. a reference, not a copy is stored).

See Also:
IHasMetadata.createMetadata(URI, IPropertyValue)

addMetadata

public void addMetadata(IMetadata metadata)
                 throws IdASException
Specified by:
addMetadata in interface IHasMetadata
Throws:
IdASException
See Also:
IHasMetadata.addMetadata(IMetadata)

removeMetadata

public void removeMetadata(IMetadata metadata)
                    throws IdASException
Specified by:
removeMetadata in interface IHasMetadata
Throws:
IdASException
See Also:
IHasMetadata.removeMetadata(IMetadata)

getMetadataSet

public Iterable<IMetadata> getMetadataSet()
                                   throws IdASException
Description copied from interface: IHasMetadata
Returns this Object's metadata elements as an Iterable. TODO: Consider overloading to take a metadata type (gets all metadata of that type)

Specified by:
getMetadataSet in interface IHasMetadata
Throws:
IdASException
See Also:
IHasMetadata.getMetadataSet()