Standard Ids

Summary

This section describes the Primordium implementations of org.osid.id.Id.

BasicId

net.okapia.osid.primordium.id.BasicId is an immutable class implementing osid.id.Id.

Serialization

        namespace:identifier@authority

Valid Characters

The characters '@' and ':' are escaped into hexadecimal ascii codes.

Constructors

Constructing BasicId
   /**
     *  Creates a new BasicId.
     *
     *  @param authority the authority for this Id
     *  @param namespace the namespace for this Id
     *  @param identifier the identifier for this Id
     *  @throws org.osid.NullArgumentException null argument provided
     */

    public BasicId(String authority, String namespace, String identifier);

Static Factories

From a String
    /**
     *  Returns an Id from its string representation: namespace:identifier@authority
     *
     *  @param str the string to be parsed
     *  @return an Id with the string components
     *  @throws org.osid.InvalidArgumentException string could not be parsed
     *  @throws org.osid.NullArgumentException str is null
     */

    public static org.osid.id.Id valueOf(String str)
From an Id
    /**
     *  Creates a new Id. This method can be used to wrap
     *  an Id of unknown origin that supports equality
     *  and hash codes based on the unique identifiers.
     *
     *  @param id an Id
     *  @throws org.osid.NullArgumentException Id is null
     */

    public static org.osid.id.Id valueOf(org.osid.id.Id id)

BasicIds can be created from other Ids when you want to get an alien Id into this serialization format.

URNId

net.okapia.osid.primordium.id.URNId is an immutable class implementing osid.id.Id.

Serialization

        urn:osid:<authority>:identifiers:<namespace>:<identifier>

Valid Characters

The following characters are valid per RFC 2141:

  • A-Z
  • a-z
  • 0-9
  • ( ) + , - . = @ ; $ _ ! * '

Other characters will be escaped using their hexadecimal codes. Colons (:) appearing in the Id will also be escaped. Slashes (/) will be escaped to a double colon (::).

Constructors

Constructing BasicId
   /**
     *  Creates a new URNId.
     *
     *  @param authority the authority for this Id
     *  @param namespace the namespace for this Id
     *  @param identifier the identifier for this Id
     *  @throws org.osid.NullArgumentException null argument provided
     */

    public URNId(String authority, String namespace, String identifier);

Static Factories

From a String
    /**
     *  Returns an Id from its string representation: 
     *         urn:osid:<authority>:identifiers:<namespace>:<identifier>
     *
     *  @param str the string to be parsed
     *  @return an Id with the string components
     *  @throws org.osid.InvalidArgumentException string could not be parsed
     *  @throws org.osid.NullArgumentException str is null
     */

    public static org.osid.id.Id valueOf(String str)
From an Id
    /**
     *  Creates a new Id. This method can be used to wrap
     *  an Id of unknown origin that supports equality
     *  and hash codes based on the unique identifiers.
     *
     *  @param id an Id
     *  @throws org.osid.NullArgumentException Id is null
     */

    public static org.osid.id.Id valueOf(org.osid.id.Id id)

URNIds can be created from other Ids when you want to get an alien Id into this URN-like serialization format.

URLId

net.okapia.osid.primordium.id.URLId is an immutable class implementing osid.id.Id.

Serialization

        http://<authority>/identifiers/<namespace>/<identifier>

Valid Characters

The following characters are valid per RFC 2396:

  • A-Z
  • a-z
  • 0-9
  • - . _ ~ ! * ( ) '

Other characters will be escaped using their hexadecimal codes.

Constructors

Constructing BasicId
   /**
     *  Creates a new <code>URLId</code>.
     *
     *  @param authority the authority for this Id
     *  @param namespace the namespace for this Id
     *  @param identifier the identifier for this Id
     *  @throws org.osid.NullArgumentException null argument provided
     */

    public URLId(String authority, String namespace, String identifier);

Static Factories

From a String
    /**
     *  Returns an Id from its string representation: 
     *         http://<authority>/identifiers/<namespace>/<identifier>
     *
     *  @param str the string to be parsed
     *  @return an Id with the string components
     *  @throws org.osid.InvalidArgumentException string could not be parsed
     *  @throws org.osid.NullArgumentException str is null
     */

    public static org.osid.id.Id valueOf(String str)
From an Id
    /**
     *  Creates a new Id. This method can be used to wrap
     *  an Id of unknown origin that supports equality
     *  and hash codes based on the unique identifiers.
     *
     *  @param id an Id
     *  @throws org.osid.NullArgumentException Id is null
     */

    public static org.osid.id.Id valueOf(org.osid.id.Id id)

URLIds can be created from other Ids when you want to get an alien Id into this URL-like serialization format.

SPI

net.okapia.osid.primordium.id.spi.AbstractId can be extended to make your own Ids to define new serialized formats for input and output. This can be done by overriding toString() and adding a valueOf() method.

See Also

 

Copyright © 2014 Okapia.