com.xebialabs.deployit.engine.xml
Class XStreamReaderWriter

java.lang.Object
  extended by com.xebialabs.deployit.engine.xml.XStreamReaderWriter
All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<java.lang.Object>, javax.ws.rs.ext.MessageBodyWriter<java.lang.Object>

@Provider
public class XStreamReaderWriter
extends java.lang.Object
implements javax.ws.rs.ext.MessageBodyReader<java.lang.Object>, javax.ws.rs.ext.MessageBodyWriter<java.lang.Object>


Constructor Summary
XStreamReaderWriter()
           
 
Method Summary
protected  com.thoughtworks.xstream.converters.Converter constructConverter(java.lang.Class<?> clazz)
          Default implementation is to call the parameterless constructor of the Converter.
static com.thoughtworks.xstream.XStream getConfiguredXStream()
           
 long getSize(java.lang.Object o, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
           
protected  void init()
           
protected  boolean isForRegisteredConverter(java.lang.Class<?> type, java.lang.reflect.Type genericType)
           
 boolean isReadable(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
           
 boolean isWriteable(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
           
 java.lang.Object readFrom(java.lang.Class<java.lang.Object> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders, java.io.InputStream entityStream)
           
static void registerConfigurationItemAliases()
          This is separate, as remote we need to have fetched the descriptors first, before we have the types to initialize XStream with.
static void registerConverter(com.thoughtworks.xstream.converters.Converter converter)
           
 void writeTo(java.lang.Object o, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders, java.io.OutputStream entityStream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XStreamReaderWriter

public XStreamReaderWriter()
Method Detail

init

protected void init()

registerConverter

public static void registerConverter(com.thoughtworks.xstream.converters.Converter converter)

registerConfigurationItemAliases

public static void registerConfigurationItemAliases()
This is separate, as remote we need to have fetched the descriptors first, before we have the types to initialize XStream with.


constructConverter

protected com.thoughtworks.xstream.converters.Converter constructConverter(java.lang.Class<?> clazz)
Default implementation is to call the parameterless constructor of the Converter. But can be overridden to look for the correct converter in for instance a Spring context.

Parameters:
clazz - The converter class
Returns:
The instantiated converter.

isReadable

public boolean isReadable(java.lang.Class<?> type,
                          java.lang.reflect.Type genericType,
                          java.lang.annotation.Annotation[] annotations,
                          javax.ws.rs.core.MediaType mediaType)
Specified by:
isReadable in interface javax.ws.rs.ext.MessageBodyReader<java.lang.Object>

isForRegisteredConverter

protected boolean isForRegisteredConverter(java.lang.Class<?> type,
                                           java.lang.reflect.Type genericType)

readFrom

public java.lang.Object readFrom(java.lang.Class<java.lang.Object> type,
                                 java.lang.reflect.Type genericType,
                                 java.lang.annotation.Annotation[] annotations,
                                 javax.ws.rs.core.MediaType mediaType,
                                 javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders,
                                 java.io.InputStream entityStream)
                          throws java.io.IOException,
                                 javax.ws.rs.WebApplicationException
Specified by:
readFrom in interface javax.ws.rs.ext.MessageBodyReader<java.lang.Object>
Throws:
java.io.IOException
javax.ws.rs.WebApplicationException

isWriteable

public boolean isWriteable(java.lang.Class<?> type,
                           java.lang.reflect.Type genericType,
                           java.lang.annotation.Annotation[] annotations,
                           javax.ws.rs.core.MediaType mediaType)
Specified by:
isWriteable in interface javax.ws.rs.ext.MessageBodyWriter<java.lang.Object>

getSize

public long getSize(java.lang.Object o,
                    java.lang.Class<?> type,
                    java.lang.reflect.Type genericType,
                    java.lang.annotation.Annotation[] annotations,
                    javax.ws.rs.core.MediaType mediaType)
Specified by:
getSize in interface javax.ws.rs.ext.MessageBodyWriter<java.lang.Object>

writeTo

public void writeTo(java.lang.Object o,
                    java.lang.Class<?> type,
                    java.lang.reflect.Type genericType,
                    java.lang.annotation.Annotation[] annotations,
                    javax.ws.rs.core.MediaType mediaType,
                    javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders,
                    java.io.OutputStream entityStream)
             throws java.io.IOException,
                    javax.ws.rs.WebApplicationException
Specified by:
writeTo in interface javax.ws.rs.ext.MessageBodyWriter<java.lang.Object>
Throws:
java.io.IOException
javax.ws.rs.WebApplicationException

getConfiguredXStream

public static com.thoughtworks.xstream.XStream getConfiguredXStream()