org.apache.clerezza.rdf.core.serializedform
Class Serializer

java.lang.Object
  extended by org.apache.clerezza.rdf.core.serializedform.Serializer

public class Serializer
extends Object

This singleton class provides a method serialize to transform a Graph into serialized RDF forms. Functionality is delegated to registered SerializingProviders. Such SerializingProviders can be registered and unregistered, later registered SerializingProviders shadow previously registered providers for the same format. Note on synchronization: SerializingProviders must be able to handle concurrent requests.

Author:
mir

Constructor Summary
Serializer()
          the constructor sets the singleton instance to allow instantiation by OSGi-DS.
 
Method Summary
 void bindSerializingProvider(SerializingProvider provider)
          Registers a Serializing provider
static Serializer getInstance()
          This returns the singleton instance, if an instance has been previously created (e.g.
 void serialize(OutputStream serializedGraph, TripleCollection tc, String formatIdentifier)
          Serializes a Graph into an OutputStream.
 void unbindSerializingProvider(SerializingProvider provider)
          Unregister a Serializing provider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Serializer

public Serializer()
the constructor sets the singleton instance to allow instantiation by OSGi-DS. This constructor should not be called except by OSGi-DS, otherwise the static getInstance method should be used.

Method Detail

getInstance

public static Serializer getInstance()
This returns the singleton instance, if an instance has been previously created (e.g. by OSGi declarative services) this instance is returned, otherwise a new instance is created and providers are injected using the service provider interface (META-INF/services/)

Returns:
the singleton Serializer instance

serialize

public void serialize(OutputStream serializedGraph,
                      TripleCollection tc,
                      String formatIdentifier)
               throws UnsupportedFormatException
Serializes a Graph into an OutputStream. This delegates the processing to the provider registered for the specified format, if the formatIdentifier contains a ';'-character only the section before that character is used for choosing the provider.

Parameters:
serializedGraph - an outputStream into which the Graph will be serialized
tc - the TripleCollection to be serialized
formatIdentifier - a string specifying the serialization format (usually the MIME-type)
Throws:
UnsupportedFormatException

bindSerializingProvider

public void bindSerializingProvider(SerializingProvider provider)
Registers a Serializing provider

Parameters:
provider - the provider to be registered

unbindSerializingProvider

public void unbindSerializingProvider(SerializingProvider provider)
Unregister a Serializing provider

Parameters:
provider - the provider to be unregistered


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