org.gcube.common.resources
Interface Resource

All Known Subinterfaces:
ResourceWrapper
All Known Implementing Classes:
DefaultResource

public interface Resource

A model of a managed resource .

Author:
Fabio Simeoni

Method Summary
 String description()
          Returns the description of the resource.
<T extends TypedFacet>
T
facet(Class<T> type)
          Returns a facet bound to a given type.
 Facet facet(QName name)
          Returns a facet with a given name.
 Set<Facet> facets()
          Returns the facets of the resource.
<T extends TypedFacet>
boolean
hasFacet(Class<T> type)
          Returns true if the resource has a facet bound to a given type.
 boolean hasFacet(QName name)
          Returns true if the resource has a facet with a given name.
 String id()
          Returns the identifier of the resource
 QName name()
          Returns the name of the resource.
 void removeFacet(QName name)
          Removes a facet with a given name.
 void setDescription(String description)
          Sets the description of the resource.
 void setFacet(Element data)
          Adds a UntypedFacet with a given data to the resource
 void setFacet(Facet facet)
          Adds a facet to the resource.
 void setName(QName name)
          Sets the name of the resource.
 long version()
          Returns the edit version of the resource.
 

Method Detail

id

String id()
Returns the identifier of the resource

Returns:
the identifier

version

long version()
Returns the edit version of the resource.

Returns:
the version

name

QName name()
Returns the name of the resource.

Returns:
the name

setName

void setName(QName name)
Sets the name of the resource.

Parameters:
name - the name

description

String description()
Returns the description of the resource.

Returns:
the description

setDescription

void setDescription(String description)
Sets the description of the resource.

Parameters:
description - the description

facets

Set<Facet> facets()
Returns the facets of the resource.

Returns:
the facets

hasFacet

boolean hasFacet(QName name)
Returns true if the resource has a facet with a given name.

Parameters:
name - the name
Returns:
true if the resource has a facet with the given name, false otherwise

hasFacet

<T extends TypedFacet> boolean hasFacet(Class<T> type)
Returns true if the resource has a facet bound to a given type.

Parameters:
type - the type
Returns:
true if the resource has a facet bound to the given type, false otherwise

facet

Facet facet(QName name)
            throws IllegalArgumentException
Returns a facet with a given name.

Parameters:
name - the name
Returns:
the facet
Throws:
IllegalArgumentException - if the resource does not have a facet with the given name

facet

<T extends TypedFacet> T facet(Class<T> type)
                           throws IllegalArgumentException
Returns a facet bound to a given type.

Parameters:
type - the type
Returns:
the facet
Throws:
IllegalArgumentException - if the resource does not have a facet bound to the given type

removeFacet

void removeFacet(QName name)
                 throws IllegalArgumentException
Removes a facet with a given name.

Parameters:
name - the name
Throws:
IllegalArgumentException - if the resource does not have a facet with the given name

setFacet

void setFacet(Facet facet)
              throws IllegalArgumentException
Adds a facet to the resource.

Parameters:
facet - the facet
Throws:
IllegalArgumentException - if the resource has already a facet with the same name

setFacet

void setFacet(Element data)
              throws IllegalArgumentException
Adds a UntypedFacet with a given data to the resource

Parameters:
data - the facet's data
Throws:
IllegalArgumentException - if the resource has already a facet with the same name


Copyright © 2012. All Rights Reserved.