org.apache.clerezza.platform.content
Class DiscobitsTypeHandler

java.lang.Object
  extended by org.apache.clerezza.platform.content.AbstractDiscobitsHandler
      extended by org.apache.clerezza.platform.content.DiscobitsTypeHandler
All Implemented Interfaces:
DiscobitsHandler
Direct Known Subclasses:
CollectionTypeHandler

@Services(value={@Service(value=java.lang.Object.class),@Service(value=DiscobitsHandler.class)})
@Property(name="org.apache.clerezza.platform.typehandler",
          boolValue=true)
@Reference(name="metaDataGenerator",
           policy=DYNAMIC,
           cardinality=OPTIONAL_MULTIPLE,
           referenceInterface=org.apache.clerezza.rdf.metadata.MetaDataGenerator.class)
public class DiscobitsTypeHandler
extends AbstractDiscobitsHandler
implements DiscobitsHandler

This Class allows getting and putting content structured using the Discobits ontology. Is an implementation of DiscobitsHandler and additionally registers as TypeHanlder to allow HTTP GET and PUT.

Author:
reto, tho, agron, mir

Field Summary
protected  org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider cgProvider
           
static String MAX_AGE
           
 
Constructor Summary
DiscobitsTypeHandler()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext context)
           
protected  void bindMetaDataGenerator(org.apache.clerezza.rdf.metadata.MetaDataGenerator generator)
           
 javax.ws.rs.core.Response delete(javax.ws.rs.core.UriInfo uriInfo)
          Deletes a hierarchy node
protected  Set<org.apache.clerezza.rdf.metadata.MetaDataGenerator> getMetaDataGenerators()
          A Set containing MetaDataGenerators to be used to add meta data to data putted by the handler.
protected  org.apache.clerezza.rdf.core.MGraph getMGraph()
           
 Object getResource(javax.ws.rs.core.UriInfo uriInfo)
          TypeHandle method for rdf types "TitledContext", "InfoDiscoBit", "OrderedContent" and "XHTMLInfoDiscoBit".
 Object mkcol(javax.ws.rs.core.UriInfo uriInfo)
          Creates a new collection at the specified uri
 javax.ws.rs.core.Response move(javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders headers)
          Moves or renames a hierarchy node
 javax.ws.rs.core.Response options(javax.ws.rs.core.UriInfo uriInfo)
           
 javax.ws.rs.core.Response propfind(javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders headers, DOMSource body)
          Finds all properties of a hierarchy node and returns them in a DOMSource
 javax.ws.rs.core.Response proppatch(javax.ws.rs.core.UriInfo uriInfo, DOMSource body)
           
 javax.ws.rs.core.Response putInfoDiscobit(javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders headers, byte[] data)
          Creates an InfoDiscoBit at the specified location
protected  void unbindMetaDataGenerator(org.apache.clerezza.rdf.metadata.MetaDataGenerator generator)
           
 
Methods inherited from class org.apache.clerezza.platform.content.AbstractDiscobitsHandler
getData, getMediaType, put, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.clerezza.platform.content.DiscobitsHandler
getData, getMediaType, put, remove
 

Field Detail

MAX_AGE

@Property(value="600",
          label="Max-Age",
          description="Specifies the value of the max-age fieldset in the cache-control header of InfoDiscoBit-Responses, as per RFC 2616 this is a number of seconds")
public static final String MAX_AGE
See Also:
Constant Field Values

cgProvider

@Reference
protected org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider cgProvider
Constructor Detail

DiscobitsTypeHandler

public DiscobitsTypeHandler()
Method Detail

activate

protected void activate(org.osgi.service.component.ComponentContext context)

getResource

public Object getResource(@Context
                          javax.ws.rs.core.UriInfo uriInfo)
TypeHandle method for rdf types "TitledContext", "InfoDiscoBit", "OrderedContent" and "XHTMLInfoDiscoBit".

Parameters:
uriInfo -
Returns:

putInfoDiscobit

public javax.ws.rs.core.Response putInfoDiscobit(@Context
                                                 javax.ws.rs.core.UriInfo uriInfo,
                                                 @Context
                                                 javax.ws.rs.core.HttpHeaders headers,
                                                 byte[] data)
Creates an InfoDiscoBit at the specified location

Parameters:
uriInfo - the uri of the InforDiscoBit to be created
data - the content of the upload

mkcol

public Object mkcol(@Context
                    javax.ws.rs.core.UriInfo uriInfo)
Creates a new collection at the specified uri

Parameters:
uriInfo -
Returns:
  • 201 "Created" response if method succeeded
  • 405 "Method Not Allowed" response if collection already exists

propfind

public javax.ws.rs.core.Response propfind(@Context
                                          javax.ws.rs.core.UriInfo uriInfo,
                                          @Context
                                          javax.ws.rs.core.HttpHeaders headers,
                                          DOMSource body)
Finds all properties of a hierarchy node and returns them in a DOMSource

Parameters:
uriInfo -
headers - HttpHeaders
body - DOMSource containing the requested properties, can be null
Returns:
  • 207 "Multistatus" response if method succeeded
  • 404 "Not Found" response if the hierarchy node was not found
  • 400 "Bad Request" response if the body is malformed

proppatch

public javax.ws.rs.core.Response proppatch(@Context
                                           javax.ws.rs.core.UriInfo uriInfo,
                                           DOMSource body)
Parameters:
uriInfo -
body - DOMSource containing properties which should be set or deleted
Returns:
  • 207 "Multistatus" response if method succeeded
  • 404 "Not Found" response if the hierarchy node was not found
  • 400 "Bad Request" response if the body is malformed

move

public javax.ws.rs.core.Response move(@Context
                                      javax.ws.rs.core.UriInfo uriInfo,
                                      @Context
                                      javax.ws.rs.core.HttpHeaders headers)
Moves or renames a hierarchy node

Parameters:
uriInfo -
headers -
Returns:
  • 201 "Created" response if method succeeded
  • 412 "Precondition Failed" response if the destination URL is already mapped to a resource
  • 404 "Not Found" response if the hierarchy node was not found
  • 403 "Forbidden" response if the source and destination resources are the same
  • 400 "Bad Request" if no "Destination" header was found

delete

public javax.ws.rs.core.Response delete(@Context
                                        javax.ws.rs.core.UriInfo uriInfo)
Deletes a hierarchy node

Parameters:
uriInfo -
Returns:
  • 200 "OK" response if method succeeded
  • 404 "Not Found" response if the hierarchy node was not found

options

public javax.ws.rs.core.Response options(@Context
                                         javax.ws.rs.core.UriInfo uriInfo)
Parameters:
uriInfo -
Returns:
  • 200 "OK" response with an "Allow" and a "DAV" header. The "Allow" header contains all the possible HTTP methods that can be executed on the resource and the "DAV" header shows if the resource is WebDAV enabled
  • 404 "Not Found" response if the resource was not found

bindMetaDataGenerator

protected void bindMetaDataGenerator(org.apache.clerezza.rdf.metadata.MetaDataGenerator generator)

unbindMetaDataGenerator

protected void unbindMetaDataGenerator(org.apache.clerezza.rdf.metadata.MetaDataGenerator generator)

getMGraph

protected org.apache.clerezza.rdf.core.MGraph getMGraph()
Specified by:
getMGraph in class AbstractDiscobitsHandler
Returns:
the MGraph to be used to retrieve and create discobits

getMetaDataGenerators

protected Set<org.apache.clerezza.rdf.metadata.MetaDataGenerator> getMetaDataGenerators()
Description copied from class: AbstractDiscobitsHandler
A Set containing MetaDataGenerators to be used to add meta data to data putted by the handler.

Specified by:
getMetaDataGenerators in class AbstractDiscobitsHandler
Returns:
a Set containing meta data generators


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.