org.n52.security.authentication
Class LicenseReference

java.lang.Object
  extended by org.n52.security.authentication.LicenseReference

public class LicenseReference
extends java.lang.Object

Class LicenseReference encapsulates common methods of a license reference.

Version:
$Revision: $
Author:
Marko Reiprecht Created on 04.03.2008, Oliver Meyer

Field Summary
static java.lang.String NAMESPACE_LICENSE
          Namespace URL of the license schema.
 
Constructor Summary
LicenseReference(org.w3c.dom.Element root)
          Constructor creates a new instance.
 
Method Summary
static LicenseReference createFrom(org.w3c.dom.Element rootNode)
          Method creates the license ref from document.
static LicenseReference createFrom(java.io.InputStream stream)
          Method creates a license reference from a stream.
static LicenseReference createFrom(java.io.Reader reader)
          Method creates a license reference from a reader.
static LicenseReference createFrom(java.lang.String ref)
          Method creates licenes ref from a string.
 boolean equals(java.lang.Object o)
          Method equals.
 java.lang.String getLicenseId()
          Method gets the licenseId.
 java.lang.String getLicenseManagerUrl()
          Method gets the licenseManagerUrl.
 org.w3c.dom.Element getReference()
          Method gets the license reference.
 java.lang.String getReferenceAsBase64EncodedString()
          Returns license reference element as Base64 encoded string.
 java.lang.String getSAMLAttributeValue(java.lang.String attributeName)
          Method getSAMLAttributeValue searches for the given attributeName in the license reference.
 int hashCode()
          Method hashCode.
 java.lang.String referenceAsString()
          Method gets the element reference as a string.
 java.lang.String toString()
           
 void validate()
          Method validates the usage properties of this reference.
 void validate(long timeDelta)
          Method validates the usage properties of this reference, with respect to time clock differences.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAMESPACE_LICENSE

public static final java.lang.String NAMESPACE_LICENSE
Namespace URL of the license schema.

See Also:
Constant Field Values
Constructor Detail

LicenseReference

public LicenseReference(org.w3c.dom.Element root)
Constructor creates a new instance.

Parameters:
root - the root.
Method Detail

getReference

public org.w3c.dom.Element getReference()
Method gets the license reference.

Returns:
Element.

getLicenseId

public java.lang.String getLicenseId()
Method gets the licenseId.

Returns:
String.

getLicenseManagerUrl

public java.lang.String getLicenseManagerUrl()
Method gets the licenseManagerUrl.

Returns:
String.

validate

public void validate()
              throws java.lang.RuntimeException
Method validates the usage properties of this reference.

Throws:
java.lang.RuntimeException - if error occurs.

validate

public void validate(long timeDelta)
              throws java.lang.RuntimeException
Method validates the usage properties of this reference, with respect to time clock differences.

Parameters:
timeDelta - allowed delta in msec.
Throws:
java.lang.RuntimeException - if error occurs.

getSAMLAttributeValue

public java.lang.String getSAMLAttributeValue(java.lang.String attributeName)
Method getSAMLAttributeValue searches for the given attributeName in the license reference.

Parameters:
attributeName - the attributeName.
Returns:
String.

createFrom

public static LicenseReference createFrom(java.io.InputStream stream)
Method creates a license reference from a stream.

Parameters:
stream - the stream.
Returns:
LicenseReference.

createFrom

public static LicenseReference createFrom(java.io.Reader reader)
Method creates a license reference from a reader.

Parameters:
reader - the reader.
Returns:
LicenseReference.

createFrom

public static LicenseReference createFrom(java.lang.String ref)
Method creates licenes ref from a string. It is a short cut for createFrom(java.io.Reader) called with a StringReader. In case string is base 64 encoded it will be decoded first.

Parameters:
ref - the ref.
Returns:
LicenseReference.

createFrom

public static LicenseReference createFrom(org.w3c.dom.Element rootNode)
Method creates the license ref from document.

Parameters:
rootNode - the rootNode.
Returns:
LicenseReference.

referenceAsString

public java.lang.String referenceAsString()
Method gets the element reference as a string.

Returns:
String.

getReferenceAsBase64EncodedString

public java.lang.String getReferenceAsBase64EncodedString()
Returns license reference element as Base64 encoded string.

Returns:
license reference element as Base64 encoded string

equals

public boolean equals(java.lang.Object o)
Method equals.

Overrides:
equals in class java.lang.Object
Parameters:
o - the o.
Returns:
boolean.

hashCode

public int hashCode()
Method hashCode.

Overrides:
hashCode in class java.lang.Object
Returns:
int.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004-2009 52north.org. All Rights Reserved.