org.opensaml.artifact
Class SAMLArtifact

java.lang.Object
  extended byorg.opensaml.artifact.SAMLArtifact
All Implemented Interfaces:
Artifact, ByteSizedSequence, SAMLArtifactChecking
Direct Known Subclasses:
SAMLArtifactType0001, SAMLArtifactType0002

public abstract class SAMLArtifact
extends Object
implements Artifact, SAMLArtifactChecking

The SAMLArtifact abstract class is a partial implementation of the Artifact interface. In particular, this class provides a final implementation of the Artifact.TypeCode interface. To complete the implementation, a subclass must implement the Artifact.RemainingArtifact and Artifact.Parser interfaces.

A SAML artifact has three components: 1) a two-byte type code, 2) a precise definition of "remaining artifact," and 3) an encoding scheme. The encoding is fixed (base64) whereas the type code and "remaining artifact" vary from artifact to artifact.

The formal definition of a SAML artifact is given by the following productions:

SAMLArtifact        := base64(TypeCode RemainingArtifact)
TypeCode            := Byte1 Byte2

An implementation must specify a type code value and provide a definition for RemainingArtifact to complete the grammar.

Subclasses of SAMLArtifact must adhere to certain naming conventions. First of all, the name of the subclass is always "SAMLArtifactType" followed by the hex encoding of the type code. For instance, a subclass that implements a type 0x0001 artifact is called SAMLArtifactType0001. Moreover, each class must contain an implementation of Artifact.Parser called (simply) Parser. In this way, the SAMLArtifact.TypeCode.getParser() method can locate the appropriate parser on-demand (based on type code).

Author:
Tom Scavo

Nested Class Summary
static class SAMLArtifact.Parser
          Subclasses of SAMLArtifact must extend this (trivial) abstract class or implement Artifact.Parser from scratch.
static class SAMLArtifact.RemainingArtifact
          Subclasses of SAMLArtifact must extend this abstract class or implement Artifact.RemainingArtifact from scratch.
static class SAMLArtifact.TypeCode
          A TypeCode is an arbitrary two-byte sequence.
 
Field Summary
protected  Artifact.RemainingArtifact remainingArtifact
          The remainingArtifact property of this SAMLArtifact object.
protected  Artifact.TypeCode typeCode
          The typeCode property of this SAMLArtifact object.
 
Fields inherited from interface org.opensaml.artifact.SAMLArtifactChecking
HANDLE_LENGTH, IDENTIFIER_LENGTH, INVALID_ARG_ERROR_MSG, LENGTH_ERROR_MSG, NULL_ARG_ERROR_MSG, PARSE_ERROR_MSG, PARSER_ERROR_MSG, TYPE_CODE_ERROR_MSG
 
Constructor Summary
protected SAMLArtifact()
           
 
Method Summary
static void checkHandleArg(byte[] handle)
           
static void checkIdentifierArg(byte[] identifier)
           
static void checkNullArg(Object obj)
           
 String encode()
          Encode this SAMLArtifact object using the base64 encoding method.
 boolean equals(Object o)
          Equate two sequences of bytes.
 byte[] getBytes()
          Get the actual bytes of this sequence of bytes.
 Artifact.RemainingArtifact getRemainingArtifact()
          Get the remainingArtifact property of this Artifact object.
 Artifact.TypeCode getTypeCode()
          Get the typeCode property of this Artifact object.
static Artifact.TypeCode getTypeCode(String s)
          Pre-parses an encoded artifact.
 int hashCode()
          Compute the hashcode of this sequences of bytes.
 int size()
          Get the size of this sequence of bytes.
 String toString()
          Encode this SAMLArtifact object using a simple hex encoding method.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

typeCode

protected Artifact.TypeCode typeCode
The typeCode property of this SAMLArtifact object.


remainingArtifact

protected Artifact.RemainingArtifact remainingArtifact
The remainingArtifact property of this SAMLArtifact object.

Constructor Detail

SAMLArtifact

protected SAMLArtifact()
Method Detail

getTypeCode

public Artifact.TypeCode getTypeCode()
Description copied from interface: Artifact
Get the typeCode property of this Artifact object.

Specified by:
getTypeCode in interface Artifact
Returns:
the typeCode property

getRemainingArtifact

public Artifact.RemainingArtifact getRemainingArtifact()
Description copied from interface: Artifact
Get the remainingArtifact property of this Artifact object.

Specified by:
getRemainingArtifact in interface Artifact
Returns:
the remainingArtifact property

size

public int size()
Description copied from interface: ByteSizedSequence
Get the size of this sequence of bytes.

Specified by:
size in interface ByteSizedSequence
Returns:
the size of the sequence

getBytes

public byte[] getBytes()
Description copied from interface: ByteSizedSequence
Get the actual bytes of this sequence of bytes.

Specified by:
getBytes in interface ByteSizedSequence
Returns:
the actual sequence of bytes

encode

public String encode()
Encode this SAMLArtifact object using the base64 encoding method.

Specified by:
encode in interface Artifact
Returns:
the encoded artifact
See Also:
Base64

toString

public String toString()
Encode this SAMLArtifact object using a simple hex encoding method.

Specified by:
toString in interface ByteSizedSequence
Returns:
the encoded artifact
See Also:
Hex

equals

public boolean equals(Object o)
Description copied from interface: ByteSizedSequence
Equate two sequences of bytes.

Specified by:
equals in interface ByteSizedSequence

hashCode

public int hashCode()
Description copied from interface: ByteSizedSequence
Compute the hashcode of this sequences of bytes.

Specified by:
hashCode in interface ByteSizedSequence

getTypeCode

public static Artifact.TypeCode getTypeCode(String s)
Pre-parses an encoded artifact. This method determines the type code of the encoded artifact. Knowing the type code, the corresponding parser may be obtained with SAMLArtifact.TypeCode.getParser(), for instance.

Parameters:
s - the string to be parsed
Returns:
the type code of the encoded artifact

checkHandleArg

public static void checkHandleArg(byte[] handle)

checkIdentifierArg

public static void checkIdentifierArg(byte[] identifier)

checkNullArg

public static void checkNullArg(Object obj)


Copyright ? 2005 UCAID. All Rights Reserved.