org.apache.jackrabbit.rmi.value
Class SerialValueFactory

java.lang.Object
  extended by org.apache.jackrabbit.rmi.value.SerialValueFactory
All Implemented Interfaces:
javax.jcr.ValueFactory

public class SerialValueFactory
extends java.lang.Object
implements javax.jcr.ValueFactory

The SerialValueFactory class is used in the RMI infrastructure to create serializable Value instances on the client side.

This class works in conjunction with the implementations of the javax.jcr.Value interface found in this package.

This class may be extended to overwrite any of the createXXXValue methods to create instances of the respective type of org.apache.jackrabbit.rmi.value.StatefullValueimplementation. The methods of the ValueFactory interface are declared final to guard against breaking the rules.


Constructor Summary
protected SerialValueFactory()
          Default constructor only visible to extensions of this class.
 
Method Summary
 javax.jcr.Binary createBinary(java.io.InputStream stream)
           
 javax.jcr.Value createValue(java.math.BigDecimal value)
          
 javax.jcr.Value createValue(javax.jcr.Binary value)
           
 javax.jcr.Value createValue(boolean value)
          
 javax.jcr.Value createValue(java.util.Calendar value)
          
 javax.jcr.Value createValue(double value)
          
 javax.jcr.Value createValue(java.io.InputStream value)
          
 javax.jcr.Value createValue(long value)
          
 javax.jcr.Value createValue(javax.jcr.Node value)
          
 javax.jcr.Value createValue(javax.jcr.Node value, boolean weak)
           
 javax.jcr.Value createValue(java.lang.String value)
          
 javax.jcr.Value createValue(java.lang.String value, int type)
          
static SerialValueFactory getInstance()
          Returns the ValueFactory instance, which currently is a singleton instance of this class.
static javax.jcr.Value makeSerialValue(javax.jcr.Value value)
          Utility method for decorating a value.
static javax.jcr.Value[] makeSerialValueArray(java.lang.String[] values)
          Utility method for converting an array of strings to serializable string values.
static javax.jcr.Value[] makeSerialValueArray(javax.jcr.Value[] values)
          Utility method for decorating an array of values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerialValueFactory

protected SerialValueFactory()
Default constructor only visible to extensions of this class. See class comments for details.

Method Detail

getInstance

public static final SerialValueFactory getInstance()
Returns the ValueFactory instance, which currently is a singleton instance of this class.

Future revisions will support some kind of configuration to specify which concrete class should be used.


makeSerialValueArray

public static javax.jcr.Value[] makeSerialValueArray(javax.jcr.Value[] values)
                                              throws javax.jcr.RepositoryException
Utility method for decorating an array of values. The returned array will contain serializable value decorators for all the given values. Note that the contents of the original values will only be copied when the decorators are serialized.

If the given array is null, then an empty array is returned.

Parameters:
values - the values to be decorated
Returns:
array of decorated values
Throws:
javax.jcr.RepositoryException - if the values can not be serialized

makeSerialValue

public static javax.jcr.Value makeSerialValue(javax.jcr.Value value)
                                       throws javax.jcr.RepositoryException
Utility method for decorating a value. Note that the contents of the original values will only be copied when the decorators are serialized. Null referenced and already serializable values are passed as-is.

Parameters:
value - the value to be decorated, or null
Returns:
the decorated value, or null
Throws:
javax.jcr.RepositoryException - if the value can not be serialized

makeSerialValueArray

public static javax.jcr.Value[] makeSerialValueArray(java.lang.String[] values)
Utility method for converting an array of strings to serializable string values.

If the given array is null, then an empty array is returned.

Parameters:
values - the string array
Returns:
array of string values

createValue

public javax.jcr.Value createValue(java.lang.String value)

Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public final javax.jcr.Value createValue(java.lang.String value,
                                         int type)
                                  throws javax.jcr.ValueFormatException

Specified by:
createValue in interface javax.jcr.ValueFactory
Throws:
javax.jcr.ValueFormatException

createValue

public final javax.jcr.Value createValue(long value)

Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public final javax.jcr.Value createValue(double value)

Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public final javax.jcr.Value createValue(boolean value)

Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public javax.jcr.Value createValue(java.math.BigDecimal value)

Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public final javax.jcr.Value createValue(java.util.Calendar value)

Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public final javax.jcr.Value createValue(java.io.InputStream value)

Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public final javax.jcr.Value createValue(javax.jcr.Node value)
                                  throws javax.jcr.RepositoryException

Specified by:
createValue in interface javax.jcr.ValueFactory
Throws:
javax.jcr.RepositoryException

createBinary

public javax.jcr.Binary createBinary(java.io.InputStream stream)
                              throws javax.jcr.RepositoryException
Specified by:
createBinary in interface javax.jcr.ValueFactory
Throws:
javax.jcr.RepositoryException

createValue

public javax.jcr.Value createValue(javax.jcr.Binary value)
Specified by:
createValue in interface javax.jcr.ValueFactory

createValue

public javax.jcr.Value createValue(javax.jcr.Node value,
                                   boolean weak)
                            throws javax.jcr.RepositoryException
Specified by:
createValue in interface javax.jcr.ValueFactory
Throws:
javax.jcr.RepositoryException


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.