|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.io.graphml.output.GraphMLWriter
public class GraphMLWriter
Writer class for GraphML.
This class allows for low-level customization of the writing process. Usually, it is used by one of GraphMLHandler's
write methods which calls one the various write method overloads. It should rarely be necessary to use this class directly.
GraphMLHandler
| Constructor Summary | |
|---|---|
GraphMLWriter()
|
|
| Method Summary | |
|---|---|
void |
addOutputHandlerProvider(OutputHandlerProvider provider)
Register an event listener that can be used to handle QueryOutputHandlersEvents. |
void |
addSerializationHandler(SerializationHandler listener)
Register an event listener that can be used to handle SerializationEvents. |
protected void |
configureDefaultOutputHandlers()
Register default event handlers for the QueryOutputHandlersEvent event. |
protected void |
configureDefaultSerializationHandlers()
Register default event handlers for the fireSerializationEvent(y.io.graphml.output.SerializationEvent) event. |
protected GraphMLWriteContext |
createWriteContext(Graph graph,
XmlWriter writer)
Create the initial GraphMLWriteContext instance. |
protected void |
fireQueryOutputHandlersEvent(QueryOutputHandlersEvent event)
Notifies all registered OutputHandlerProvider instances of event. |
protected void |
fireSerializationEvent(SerializationEvent event)
Notifies all registered SerializationHandler instances of event. |
protected Map |
getOutputHandlers(GraphMLWriteContext context)
Dynamically retrieve all OutputHandler that should be used for the current write process. |
Object |
getSerializationProperty(Object key)
Retrieve a serialization property that has been set by setSerializationProperty(Object,Object). |
WriteEventHandler |
getWriteEventHandler()
Return a WriteEventHandler that can be used to subscribe to
various events in the write process. |
protected Object |
lookup(Class type)
Dynamically retrieve an instance of type. |
void |
removeLookup(Class t)
Remove an implementation of t that has been set with setLookup(Class,Object). |
void |
removeOutputHandlerProvider(OutputHandlerProvider provider)
Unregister an event listener that has been registered with addOutputHandlerProvider(OutputHandlerProvider). |
void |
removeSerializationHandler(SerializationHandler listener)
Unregister an event listener that has been registered with addSerializationHandler(y.io.graphml.output.SerializationHandler). |
void |
removeSerializationProperty(Object key)
Remove a serialization property that has been set by setSerializationProperty(Object,Object). |
protected void |
serialize(GraphMLWriteContext context,
Object item,
Class serializationType)
Serialize item to XML content. |
void |
setLookup(Class t,
Object instance)
Register an initial implementation of t for use with Lookup. |
void |
setSerializationProperty(Object key,
Object value)
Set an initial serialization property that allows to fine tune the write process. |
void |
write(Graph graph,
XmlWriter writer)
Write the GraphML representation of graph,
Typically, this method is called indirectly from
GraphMLHandler.write(Graph,java.io.OutputStream) and it's overloads. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GraphMLWriter()
| Method Detail |
|---|
public void addOutputHandlerProvider(OutputHandlerProvider provider)
QueryOutputHandlersEvents.
Registering a listener allows to use OutputHandlers dynamically, depending on the
actual graph data. For each write, a QueryOutputHandlersEvent is fired and
propagated to all registered event listeners.
Usually, this method should not be used directly, register event listeners
with GraphMLHandler.addOutputHandlerProvider(OutputHandlerProvider)
on an GraphMLHandler instance instead.
provider - Event listener for the QueryInputHandlersEventfireQueryOutputHandlersEvent(QueryOutputHandlersEvent),
removeOutputHandlerProvider(OutputHandlerProvider),
GraphMLHandler.addOutputHandlerProvider(OutputHandlerProvider)public void removeOutputHandlerProvider(OutputHandlerProvider provider)
addOutputHandlerProvider(OutputHandlerProvider).
provider - Event listener for the QueryOutputHandlersEventfireQueryOutputHandlersEvent(QueryOutputHandlersEvent),
addOutputHandlerProvider(OutputHandlerProvider),
GraphMLHandler.removeOutputHandlerProvider(OutputHandlerProvider)
protected void fireQueryOutputHandlersEvent(QueryOutputHandlersEvent event)
throws GraphMLWriteException
OutputHandlerProvider instances of event.
For each write, a QueryOutputHandlersEvent is fired and
propagated to all registered event listeners.
GraphMLWriteExceptionevent - The event that has been raised.OutputHandler,
OutputHandlerProvider,
addOutputHandlerProvider(OutputHandlerProvider),
GraphMLHandler.fireQueryOutputHandlersEvent(QueryOutputHandlersEvent)public void addSerializationHandler(SerializationHandler listener)
SerializationEvents.
Registering a listener allows to use custom serialization code.
Usually, this method should not be used directly, register event listeners
with GraphMLHandler.addSerializationHandler(SerializationHandler)
on an GraphMLHandler instance instead.
listener - Event listener for the SerializationEventfireSerializationEvent(SerializationEvent),
removeSerializationHandler(y.io.graphml.output.SerializationHandler),
GraphMLHandler.addSerializationHandler(y.io.graphml.output.SerializationHandler)public void removeSerializationHandler(SerializationHandler listener)
addSerializationHandler(y.io.graphml.output.SerializationHandler).
listener - Event listener for the SerializationEventfireSerializationEvent(SerializationEvent),
addSerializationHandler(y.io.graphml.output.SerializationHandler),
GraphMLHandler.removeSerializationHandler(y.io.graphml.output.SerializationHandler)
protected void fireSerializationEvent(SerializationEvent event)
throws GraphMLWriteException
SerializationHandler instances of event.
Usually, this method is called indirectly through calls to
GraphMLWriteContext.serialize(Object)
to write the XML representation of an object.
GraphMLWriteExceptionevent - The event that has been raised.SerializationHandler,
addSerializationHandler(y.io.graphml.output.SerializationHandler),
GraphMLWriteContext.serialize(Object),
GraphMLHandler.fireSerializationEvent(y.io.graphml.output.SerializationEvent)protected void configureDefaultSerializationHandlers()
fireSerializationEvent(y.io.graphml.output.SerializationEvent) event.
This implementation does not register any default event handlers
GraphMLHandler.configureSerializationHandlers(y.base.Graph,y.io.graphml.output.GraphMLWriter)protected void configureDefaultOutputHandlers()
QueryOutputHandlersEvent event.
This implementation does not register any default event handlers
GraphMLHandler.configureOutputHandlers(y.base.Graph,GraphMLWriter)
protected Map getOutputHandlers(GraphMLWriteContext context)
throws GraphMLWriteException
OutputHandler that should be used for the current write process.
Typically, this method is called only indirectly by the write process.
This implementation calls fireQueryOutputHandlersEvent(QueryOutputHandlersEvent), which in
turn raises the QueryOutputHandlersEvent event.
GraphMLWriteExceptioncontext - The current write context.
KeyScopes as keys and a list of OutputHandler
for each scope as values.
protected void serialize(GraphMLWriteContext context,
Object item,
Class serializationType)
throws GraphMLWriteException
item to XML content.
Typically, this method is called only indirectly by calls to one of
GraphMLWriteContext's serialize
. * methods.
This implementation calls fireSerializationEvent(y.io.graphml.output.SerializationEvent).
GraphMLWriteExceptioncontext - The current write context.item - The object should be serialized.GraphMLWriteContext.serialize(Object),
GraphMLWriteContext.serialize(GraphMLWriteContext, Object, Class)
public void setSerializationProperty(Object key,
Object value)
To dynamically set or change property values during the write process, create a new
ChildWriteContext
and set the property with the corresponding property handling methods.
key - The key for the property.value - The property value.getSerializationProperty(Object),
GraphMLWriteContext.getSerializationProperty(Object)public void removeSerializationProperty(Object key)
setSerializationProperty(Object,Object).
key - The key for the property.GraphMLWriteContext.getSerializationProperty(Object),
setSerializationProperty(Object,Object)public Object getSerializationProperty(Object key)
setSerializationProperty(Object,Object).
key - The key for the property.GraphMLWriteContext.getSerializationProperty(Object),
setSerializationProperty(Object,Object)
public void setLookup(Class t,
Object instance)
t for use with Lookup.
To dynamically modify lookup behaviour during the write process, create a new ChildWriteContext
and use the corresponding lookup handling methods.
t - The type for which an implementation should be registeredinstance - The implementation of t for lookup retrieval.lookup,
Lookup.lookup(Class)public void removeLookup(Class t)
t that has been set with setLookup(Class,Object).
To dynamically modify lookup behaviour during the parse process, create a new ChildWriteContext
and use the corresponding lookup handling methods.
t - The type for which an implementation should be removedsetLookup(Class,Object),
lookup,
Lookup.lookup(Class)protected Object lookup(Class type)
type.
type - The type for which an implementation is needed.
type, or null.Lookup.lookup(Class),
setLookup(Class,Object)
protected GraphMLWriteContext createWriteContext(Graph graph,
XmlWriter writer)
GraphMLWriteContext instance.
graph - The graph that is written.writer - The core XmlWriter instance that does the actual writing of XML content.
GraphMLWriteContext instance that is suitable for graph.
public void write(Graph graph,
XmlWriter writer)
throws GraphMLWriteException
graph,
Typically, this method is called indirectly from
GraphMLHandler.write(Graph,java.io.OutputStream) and it's overloads.
GraphMLWriteExceptiongraph - The graph instance that is populated.writer - The writer that actually writes the XML content.GraphMLHandler.write(Graph,java.io.OutputStream),
GraphMLHandler.write(Graph,java.io.OutputStream,String),
GraphMLHandler.write(Graph,java.io.Writer)public WriteEventHandler getWriteEventHandler()
WriteEventHandler that can be used to subscribe to
various events in the write process.
WriteEventHandler implementation.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||