eu.planets_project.services.datatypes
Class ServiceDescription

java.lang.Object
  extended by eu.planets_project.services.datatypes.ServiceDescription

public final class ServiceDescription
extends java.lang.Object

A entity to hold metadata about services. The content of this object was first defined at the IF meeting in September 2008. This is intended to be used primarily as an XML schema, but is defined in Java to make reading/writing easier. See also, DOAP: http://trac.usefulinc.com/doap

This class is immutable in practice; its instances can therefore be shared freely and concurrently. Instances are created using a builder to allow optional named constructor parameters and ensure consistent state during creation. E.g. to create a service description with only the required arguments, you'd use:

ServiceDescription d = new ServiceDescription.Builder(name, type).build();

You can cascade additional calls for optional arguments:

ServiceDescription d = new ServiceDescription.Builder(name, type).paths(path1,path2).logo(logo).build();

ServiceDescription instances can be serialized to XML. Given such an XML representation, a service description can be instantiated using a static factory method:

ServiceDescription d = ServiceDescription.of(xml);

To use a given service description (either as an object or as XML) as a template for your service description, you can give it to the builder and add or override values:

ServiceDescription d = new ServiceDescription.Builder(xml).paths(path1, path2).logo(logo).build();

A corresponding XML schema can be generated from this class by running this class as a Java application, see main(String[]).

For usage examples, see the tests in ServiceDescriptionTest.

See Also:
ServiceDescriptionTest

Nested Class Summary
static class ServiceDescription.Builder
          Builder for ServiceDescription instances.
 
Field Summary
static java.lang.String AUTHORIZED_ROLES
          Key to be used for properties indicating authorized roles.
static java.net.URI PROPERTY
          URI to use for service description properties.
 
Method Summary
static ServiceDescription.Builder copy(ServiceDescription serviceDescription)
           
static ServiceDescription.Builder create(java.lang.String name, java.lang.String type)
           
 boolean equals(java.lang.Object obj)
          
 java.lang.String getAuthor()
           
 java.lang.String getClassname()
           
 java.lang.String getDescription()
           
 java.net.URL getEndpoint()
           
 java.net.URI getFurtherInfo()
           
 java.lang.String getIdentifier()
           
 java.util.List<java.net.URI> getInputFormats()
           
 java.lang.String getInstructions()
           
 java.net.URI getLogo()
           
 java.lang.String getName()
           
 java.util.List<Parameter> getParameters()
           
 java.util.List<MigrationPath> getPaths()
           
 java.util.List<Property> getProperties()
           
 java.lang.String getServiceProvider()
           
 Tool getTool()
           
 java.lang.String getType()
           
 java.lang.String getVersion()
           
 int hashCode()
          
static void main(java.lang.String[] args)
          Generates the XML schema for this class.
static ServiceDescription of(java.lang.String xml)
           
 java.lang.String toString()
          
 java.lang.String toXml()
           
 java.lang.String toXmlFormatted()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY

public static final java.net.URI PROPERTY
URI to use for service description properties.


AUTHORIZED_ROLES

public static final java.lang.String AUTHORIZED_ROLES
Key to be used for properties indicating authorized roles.

See Also:
Constant Field Values
Method Detail

create

public static ServiceDescription.Builder create(java.lang.String name,
                                                java.lang.String type)
Parameters:
name - The name of the service description to build
type - The type of service description to build
Returns:
The builder, to alter the created service description; call build() on the builder to create the actual service description

copy

public static ServiceDescription.Builder copy(ServiceDescription serviceDescription)
Parameters:
serviceDescription - The service description to copy
Returns:
The builder, to alter the created service description; call build() on the builder to create the actual service description

getName

public java.lang.String getName()
Returns:
the name

getClassname

public java.lang.String getClassname()
Returns:
the classname

getType

public java.lang.String getType()
Returns:
the type

getEndpoint

public java.net.URL getEndpoint()
Returns:
the endpoint

getParameters

public java.util.List<Parameter> getParameters()
Returns:
a copy of the parameters

getTool

public Tool getTool()
Returns:
the tool

getDescription

public java.lang.String getDescription()
Returns:
the description

getVersion

public java.lang.String getVersion()
Returns:
the version

getAuthor

public java.lang.String getAuthor()
Returns:
the author

getServiceProvider

public java.lang.String getServiceProvider()
Returns:
the serviceProvider

getInstructions

public java.lang.String getInstructions()
Returns:
the instructions

getFurtherInfo

public java.net.URI getFurtherInfo()
Returns:
the furtherInfo

getLogo

public java.net.URI getLogo()
Returns:
the logo

getIdentifier

public java.lang.String getIdentifier()
Returns:
the identifier

getPaths

public java.util.List<MigrationPath> getPaths()
Returns:
the paths (unmodifiable)

getInputFormats

public java.util.List<java.net.URI> getInputFormats()
Returns:
the inputFormats (unmodifiable)

getProperties

public java.util.List<Property> getProperties()
Returns:
the properties (unmodifiable)

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

of

public static ServiceDescription of(java.lang.String xml)
Parameters:
xml - The XML representation of a service description (as created from calling toXml)
Returns:
A digital object instance created from the given XML

toXml

public java.lang.String toXml()
Returns:
An XML representation of this service description (can be used to instantiate an object using the static factory method)

toXmlFormatted

public java.lang.String toXmlFormatted()
Returns:
A formatted (pretty-printed) XML representation of this service description

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

main

public static void main(java.lang.String[] args)
Generates the XML schema for this class.

Parameters:
args - Ignored


Copyright © 2007-2010 The Planets Consortium. All Rights Reserved.