|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.yworks.yfiles.server.graphml.support.AbstractGraphRoundtripSupport
Common base class for the server-side roundtrip support classes.
Field Summary | |
static java.lang.String |
EDGE_2_ID_DPKEY
Key for storing the current edge id EdgeMap in the graph. |
protected java.util.List |
mappers
|
static java.lang.String |
NODE_2_ID_DPKEY
Key for storing the current node id NodeMap in the graph. |
protected java.util.List |
objectMappers
|
static java.lang.String |
PARAM_GRAPH
Parameter name of the request parameter that contains graphml sent by the client. |
static java.lang.String |
RESPONSE_DOCUMENT_TAG
The xml element name that is used as the outermost tag for all non-graphml server responses. |
static java.lang.String |
USERTAGS_DPKEY
Key for storing the current user tag map in the graph |
Constructor Summary | |
AbstractGraphRoundtripSupport()
|
Method Summary | |
void |
addMapper(java.lang.Object tag,
java.lang.String name,
KeyType valueType,
KeyScope scope)
Adds integrated support for the round tripping of simple data associated with graph elements. |
void |
addObjectMapper(java.lang.Object tag,
KeyScope scope,
SerializationHandler serializer,
DeserializationHandler deserializer)
Adds integrated support for the round tripping of complex data associated with graph elements. |
protected void |
configureRoundtripGraph(LayoutGraph layoutGraph)
Configure the layout graph. |
protected InputHandlerProvider |
createAutoMapperInputHandlerProvider()
|
protected OutputHandlerProvider |
createAutoMapperOutputHandlerProvider()
|
protected static ParseEventListener |
createDefaultElementTagWrapper()
|
protected InputHandlerProvider |
createInputHandlerProvider(java.lang.String name,
java.lang.Object tag,
KeyScope scope,
KeyType type,
boolean autoCreateDataMap)
Creates a provider providing an InputHandler for the given name , scope and
type that stores the parsed data in a data map with the given tag . |
protected InputHandlerProvider |
createObjectInputHandlerProvider(java.lang.String name,
java.lang.Object tag,
KeyScope scope,
DeserializationHandler deserializer,
boolean autoCreateDataMap)
Creates a provider providing an InputHandler for the given name and scope
that stores the parsed data in a data map with the given tag .
|
protected OutputHandlerProvider |
createObjectOutputHandlerProvider(java.lang.String name,
java.lang.Object tag,
KeyScope scope,
SerializationHandler serializer)
Creates a provider providing an output handler for the given name and scope .
|
protected OutputHandlerProvider |
createOutputHandlerProvider(java.lang.String name,
java.lang.Object tag,
KeyScope scope,
KeyType type)
Creates a provider providing an output handler for the given name and scope .
|
protected InputHandlerProvider |
createTagInputHandlerProvider()
Creates a new input handler provider instance that provides an input handler which handles user tags. |
protected OutputHandler |
createTagOutputHandler()
Creates a new output handler instance which handles user tags. |
XmlWriter |
createXmlWriter(java.io.OutputStream os)
Creates a XMLWriter instance that can be used for sending xml formatted responses to the client. |
protected GraphDecoder |
getGraphDecoder()
Get the decoder that is used to decode the data received from the client. |
protected InputHandlerProvider |
getTagInputHandlerProvider()
Returns the input handler provider for the user tags. |
protected OutputHandler |
getTagOutputHandler()
Returns the output handler for the user tags. |
boolean |
isSupportUserTags()
Whether to support user tags. |
void |
sendError(java.lang.Throwable e,
java.io.OutputStream outputStream)
Send an error to the client. |
void |
setSupportUserTags(boolean supportUserTags)
Whether to support user tags. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.yworks.yfiles.server.graphml.support.RoundtripSupport |
createRoundtripGraph, readGraph, readGraph, sendGraph |
Field Detail |
protected java.util.List mappers
protected java.util.List objectMappers
public static final java.lang.String NODE_2_ID_DPKEY
public static final java.lang.String EDGE_2_ID_DPKEY
public static final java.lang.String PARAM_GRAPH
public static final java.lang.String RESPONSE_DOCUMENT_TAG
public static final java.lang.String USERTAGS_DPKEY
Constructor Detail |
public AbstractGraphRoundtripSupport()
Method Detail |
protected GraphDecoder getGraphDecoder()
public void addMapper(java.lang.Object tag, java.lang.String name, KeyType valueType, KeyScope scope)
RoundtripSupport
DataMap
will be automatically registered using the provided
key on the graph instances created by RoundtripSupport.createRoundtripGraph()
.
addMapper
in interface RoundtripSupport
tag
- The tag to use for the DataMap
that can be queried from the graph's instance
using Graph.getDataProvider(Object)
.name
- The name to use for the data in the GraphML file.valueType
- A KeyType
describing the type of the data.scope
- A KeyScope
describing the scope of the data.public void addObjectMapper(java.lang.Object tag, KeyScope scope, SerializationHandler serializer, DeserializationHandler deserializer)
RoundtripSupport
DataMap
will be automatically registered using the provided
key on the graph instances created by RoundtripSupport.createRoundtripGraph()
.
addObjectMapper
in interface RoundtripSupport
tag
- The tag to use for the DataMap
that can be queried from the graph's instance
using Graph.getDataProvider(Object)
.scope
- A KeyScope
describing the scope of the data.serializer
- The serializer instance that will be used for writing the complex data objects.deserializer
- The deserializer instance that will be used for reading the complex data objects.public XmlWriter createXmlWriter(java.io.OutputStream os) throws GraphMLWriteException
os
- An output stream to write xml to
GraphMLWriteException
public void sendError(java.lang.Throwable e, java.io.OutputStream outputStream) throws java.io.IOException
<?xml version="1.0" encoding="UTF-8"?> <response> <errors> <error> <![CDATA[ error message ]]> </error> </errors> </response>
sendError
in interface RoundtripSupport
e
- The error.outputStream
- the stream to write the error to - this stream will not be closed.
java.io.IOException
- If writing to the response writer fails.protected void configureRoundtripGraph(LayoutGraph layoutGraph)
The default implementation adds the data providers that are required for client-server round tripping and the data
providers for any custom mappers that were added using
addMapper(Object, String,y.io.graphml.KeyType,y.io.graphml.KeyScope)
and
addObjectMapper(Object, y.io.graphml.KeyScope, y.io.graphml.output.SerializationHandler, y.io.graphml.input.DeserializationHandler)
.
layoutGraph
- The layout graph instance that is used for round tripping.public boolean isSupportUserTags()
RoundtripSupport
isSupportUserTags
in interface RoundtripSupport
true
if user tags will be read / sent.public void setSupportUserTags(boolean supportUserTags)
RoundtripSupport
Default is false
setSupportUserTags
in interface RoundtripSupport
supportUserTags
- true
if user tags will be read / sent.protected InputHandlerProvider getTagInputHandlerProvider()
Calls createTagInputHandlerProvider()
to create a new instance if needed.
protected InputHandlerProvider createTagInputHandlerProvider()
protected OutputHandler getTagOutputHandler()
Calls createTagOutputHandler()
to create a new instance if needed.
protected OutputHandler createTagOutputHandler()
protected InputHandlerProvider createInputHandlerProvider(java.lang.String name, java.lang.Object tag, KeyScope scope, KeyType type, boolean autoCreateDataMap)
InputHandler
for the given name
, scope
and
type
that stores the parsed data in a data map with the given tag
.
name
- The attr.name attribute of the graphml key definition.tag
- Tha data provider tag.scope
- The scope the input handler provider shall provide an input handler for.type
- The type the input handler provider shall provide an input handler for.autoCreateDataMap
- Whether a DataMap shall be created and added to the graph if there is none registered by
the given tag
.
name
, scope
and type
that stores the parsed data in a data map with the given tag
.protected InputHandlerProvider createObjectInputHandlerProvider(java.lang.String name, java.lang.Object tag, KeyScope scope, DeserializationHandler deserializer, boolean autoCreateDataMap)
InputHandler
for the given name
and scope
that stores the parsed data in a data map with the given tag
.
The given deserializer
is used to parse the data elements.
name
- The attr.name attribute of the graphml key definition.tag
- Tha data provider tag.scope
- The scope the input handler provider shall provide an input handler for.deserializer
- autoCreateDataMap
- Whether a DataMap shall be created and added to the graph if there is none registered by
the given tag
.
name
and scope
that stores the parsed data in a data map with the given tag
.protected OutputHandlerProvider createOutputHandlerProvider(java.lang.String name, java.lang.Object tag, KeyScope scope, KeyType type)
name
and scope
.
The data is retrieved from a data provider that has to be registered at the graph with the given tag
and serialized using the given serializer
.
name
- The attr.name to use for the written key element.tag
- The tag the data is registered at the graph with.scope
- The scope the data shall be written for.type
- The type of the data to write.
name
and scope
.protected OutputHandlerProvider createObjectOutputHandlerProvider(java.lang.String name, java.lang.Object tag, KeyScope scope, SerializationHandler serializer)
name
and scope
.
The data is retrieved from a data provider that has to be registered at the graph with the given tag
and serialized using the given serializer
.
name
- The attr.name to use for the written key element.tag
- The tag the data is registered at the graph with.scope
- The scope the data shall be written for.serializer
- The SerializationHandler used to write each data.
name
and scope
.protected OutputHandlerProvider createAutoMapperOutputHandlerProvider()
protected InputHandlerProvider createAutoMapperInputHandlerProvider()
protected static ParseEventListener createDefaultElementTagWrapper()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |