jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r169297 [2/2] - in /incubator/jackrabbit/trunk/contrib/jcr-rmi: ./ src/java/org/apache/jackrabbit/rmi/client/ src/java/org/apache/jackrabbit/rmi/remote/ src/java/org/apache/jackrabbit/rmi/server/ src/java/org/apache/jackrabbit/value/ src/java/org/apache/jackrabbit/value/doc-files/ src/test/org/apache/jackrabbit/test/rmi/
Date Mon, 09 May 2005 11:55:19 GMT
Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/ReferenceValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValue.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValue.java?rev=169297&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValue.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValue.java Mon May  9 04:55:17 2005
@@ -0,0 +1,304 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.value;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Calendar;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+
+/**
+ * Stateful value implementation. This class implements the Context
+ * part of the State design pattern (GoF) used for managing the JCR Value
+ * states.
+ * <p>
+ * Instances of this class are issued by the {@link org.apache.jackrabbit.value.SerialValueFactory}
+ * and are <code>Serializable</code>.
+ *
+ * @see org.apache.jackrabbit.value.SerialValueFactory
+ */
+final class SerialValue implements Value, Serializable {
+
+    /** Static serial version UID. */
+    static final long serialVersionUID = 6970955308427991717L;
+    
+    /**
+     * Type of the underlying value. Note that this type is never changed
+     * even if the value state changes. Thus the type is memorized in this
+     * member variable when the value instance is created.
+     */
+    private int type;
+
+    /**
+     * The underlying value instance. This is the state reference that
+     * changes during state transitions.
+     */
+    private StatefullValue value;
+
+    /**
+     * Creates a generic value instance.  A new InitialValue instance
+     * that wraps the given static value instance is created to intercept
+     * the first getter method. The created InitialValue instance has
+     * the responsibility of changing the value state.
+     *
+     * @param value underlying static value instance
+     */
+    SerialValue(StatefullValue value) {
+        this.type = value.getType();
+        this.value = new InitialValue(this, value);
+    }
+
+    /**
+     * Changes the value state. This method is invoked by the
+     * {@link InitialValue InitialValue} class to commit the value state.
+     *
+     * @param value new value state
+     */
+    void setValue(StatefullValue value) {
+        this.value = value;
+    }
+
+    /**
+     * Returns the binary representation of the value. The actual behaviour
+     * depends on the current state of the value, see the JCR documentation
+     * for the details.
+     *
+     * @return binary value
+     * @throws IllegalStateException if the value is in non-stream state
+     * @throws RepositoryException if another error occurs
+     * @see Value#getStream()
+     */
+    public InputStream getStream() throws IllegalStateException,
+            RepositoryException {
+        return value.getStream();
+    }
+
+    /**
+     * Returns the string representation of the value. The actual behaviour
+     * depends on the current state of the value, see the JCR documentation
+     * for the details.
+     *
+     * @return string value
+     * @throws ValueFormatException if conversion to string is not possible
+     * @throws IllegalStateException if the value is in stream state
+     * @throws RepositoryException if another error occurs
+     * @see Value#getString()
+     */
+    public String getString() throws ValueFormatException,
+            IllegalStateException, RepositoryException {
+        return value.getString();
+    }
+
+    /**
+     * Returns the long representation of the value. The actual behaviour
+     * depends on the current state of the value, see the JCR documentation
+     * for the details.
+     *
+     * @return long value
+     * @throws ValueFormatException if conversion to long is not possible
+     * @throws IllegalStateException if the value is in stream state
+     * @throws RepositoryException if another error occurs
+     * @see Value#getLong()
+     */
+    public long getLong() throws ValueFormatException,
+            IllegalStateException, RepositoryException {
+        return value.getLong();
+    }
+
+    /**
+     * Returns the double representation of the value. The actual behaviour
+     * depends on the current state of the value, see the JCR documentation
+     * for the details.
+     *
+     * @return double value
+     * @throws ValueFormatException if conversion to double is not possible
+     * @throws IllegalStateException if the value is in stream state
+     * @throws RepositoryException if another error occurs
+     * @see Value#getDouble()
+     */
+    public double getDouble() throws ValueFormatException,
+            IllegalStateException, RepositoryException {
+        return value.getDouble();
+    }
+
+    /**
+     * Returns the date representation of the value. The actual behaviour
+     * depends on the current state of the value, see the JCR documentation
+     * for the details.
+     *
+     * @return date value
+     * @throws ValueFormatException if conversion to date is not possible
+     * @throws IllegalStateException if the value is in stream state
+     * @throws RepositoryException if another error occurs
+     * @see Value#getDate()
+     */
+    public Calendar getDate() throws ValueFormatException,
+            IllegalStateException, RepositoryException {
+        return value.getDate();
+    }
+
+    /**
+     * Returns the boolean representation of the value. The actual behaviour
+     * depends on the current state of the value, see the JCR documentation
+     * for the details.
+     *
+     * @return boolean value
+     * @throws ValueFormatException if conversion to boolean is not possible
+     * @throws IllegalStateException if the value is in stream state
+     * @throws RepositoryException if another error occurs
+     * @see Value#getDouble()
+     */
+    public boolean getBoolean() throws ValueFormatException,
+            IllegalStateException, RepositoryException {
+        return value.getBoolean();
+    }
+
+    /**
+     * Returns the value type. Note that value type remains the same even
+     * if the underlying value is converted to another type during the
+     * stream/non-stream state transition.
+     *
+     * @return value type
+     * @see javax.jcr.PropertyType
+     * @see Value#getType()
+     */
+    public int getType() {
+        return type;
+    }
+
+    //---------- Serializable interface support --------------------------------
+
+    /**
+     * Serializes the underlying Value object. Instead of using
+     * the normal serialization mechanism, the essential state
+     * of the Value object is extracted and written to the serialization
+     * stream as a type-value pair.
+     *
+     * @param out the serialization stream
+     * @throws IOException on IO errors
+     */
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        try {
+            // write real type
+            out.writeInt(type);
+
+            switch (type) {
+                case PropertyType.BINARY:
+                    InputStream data = value.getStream();
+                    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+                    byte[] bytes = new byte[4096];
+                    for (int n = data.read(bytes); n != -1; n = data
+                        .read(bytes)) {
+                        buffer.write(bytes, 0, n);
+                    }
+                    out.writeInt(buffer.size());
+                    buffer.writeTo(out);
+                    break;
+                case PropertyType.BOOLEAN:
+                    out.writeBoolean(value.getBoolean());
+                    break;
+                case PropertyType.DATE:
+                    out.writeObject(value.getDate());
+                    break;
+                case PropertyType.DOUBLE:
+                    out.writeDouble(value.getDouble());
+                    break;
+                case PropertyType.LONG:
+                    out.writeLong(value.getLong());
+                    break;
+                case PropertyType.NAME:
+                case PropertyType.PATH:
+                case PropertyType.REFERENCE:
+                case PropertyType.STRING:
+                    out.writeUTF(value.getString());
+                    break;
+                default:
+                    throw new IOException("Unknown value type");
+            }
+        } catch (RepositoryException ex) {
+            throw new IOException(ex.getMessage());
+        }
+    }
+
+    /**
+     * Deserializes the underlying Value object. A new Value object
+     * is created based on the type and state data read fro the
+     * serialization stream.
+     *
+     * @param in the serialization stream
+     * @throws IOException on IO errors
+     */
+    private void readObject(ObjectInputStream in) throws IOException {
+        try {
+            SerialValueFactory factory = SerialValueFactory.getInstance();
+            StatefullValue realValue;
+            int type = in.readInt();
+            switch (type) {
+                case PropertyType.BINARY:
+                    byte[] bytes = new byte[in.readInt()];
+                    in.readFully(bytes);
+                    ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
+                    realValue = factory.createBinaryValue(bin);
+                    break;
+                case PropertyType.BOOLEAN:
+                    realValue = factory.createBooleanValue(in.readBoolean());
+                    break;
+                case PropertyType.DATE:
+                    realValue = factory.createDateValue((Calendar) in.readObject());
+                    break;
+                case PropertyType.DOUBLE:
+                    realValue = factory.createDoubleValue(in.readDouble());
+                    break;
+                case PropertyType.LONG:
+                    realValue = factory.createLongValue(in.readLong());
+                    break;
+                case PropertyType.NAME:
+                    realValue = factory.createNameValue(in.readUTF());
+                    break;
+                case PropertyType.PATH:
+                    realValue = factory.createPathValue(in.readUTF());
+                    break;
+                case PropertyType.REFERENCE:
+                    realValue = factory.createReferenceValue(in.readUTF());
+                    break;
+                case PropertyType.STRING:
+                    realValue = factory.createStringValue(in.readUTF());
+                    break;
+                default:
+                    throw new IllegalStateException("Illegal serial value type");
+            }
+
+            // now we set the fields
+            this.type = type;
+            this.value = new InitialValue(this, realValue);
+
+        } catch (ValueFormatException vfe) {
+            throw new IOException(vfe.getMessage());
+        } catch (ClassNotFoundException ex) {
+            throw new IOException(ex.getMessage());
+        }
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValueFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValueFactory.java?rev=169297&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValueFactory.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValueFactory.java Mon May  9 04:55:17 2005
@@ -0,0 +1,405 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.value;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.Calendar;
+
+import javax.jcr.Node;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * The <code>SerialValueFactory</code> class is used in the RMI infrastructure
+ * to create serializable <code>Value</code> instances on the client side.
+ * <p>
+ * This class works in conjunction with the implementations of the
+ * <code>javax.jcr.Value</code> interface found in this package.
+ * <p>
+ * This class may be extended to overwrite any of the
+ * <code>createXXXValue</code> methods to create instances of the respective
+ * type of {@link org.apache.jackrabbit.value.StatefullValue}implementation. The
+ * methods of the <code>ValueFactory</code> interface are declared final to
+ * guard against breaking the rules.
+ * 
+ * @version $Revision$, $Date$
+ * @author Jukka Zitting
+ * @author Felix Meschberger
+ * @since 0.16.4.1
+ */
+public class SerialValueFactory implements ValueFactory {
+
+    /** The singleton value factory instance */
+    private static final SerialValueFactory INSTANCE = new SerialValueFactory();
+    
+    /**
+     * Returns the <code>ValueFactory</code> instance, which currently is a
+     * singleton instance of this class.
+     * <p>
+     * Future revisions will support some kind of configuration to specify
+     * which concrete class should be used.
+     */
+    public static final SerialValueFactory getInstance() {
+        return INSTANCE;
+    }
+
+    /**
+     * 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.
+     * <p>
+     * If the given array is <code>null</code>, then an empty array is
+     * returned.
+     * 
+     * @param values the values to be decorated
+     * @return array of decorated values
+     */
+    public static Value[] makeSerialValueArray(Value[] values) {
+        if (values != null) {
+            Value[] serials = new Value[values.length];
+            for (int i = 0; i < values.length; i++) {
+                serials[i] = makeSerialValue(values[i]);
+            }
+            return serials;
+        } else {
+            return new Value[0];
+        }
+    }
+
+    /**
+     * Utility method for decorating a value. Note that the contents of the
+     * original values will only be copied when the decorators are serialized.
+     * 
+     * @param value the value to be decorated
+     * @return the decorated value
+     */
+    public static Value makeSerialValue(Value value) {
+        // if the value is already serializable, just return it
+        // - or should we test for SerialValue ??
+        if (value instanceof SerialValue) {
+            return value;
+        }
+
+        // convert to a general vaule
+        return new SerialValue(new StatefullValueAdapter(value));
+    }
+
+    /**
+     * Default constructor only visible to extensions of this class. See
+     * class comments for details.
+     */
+    protected SerialValueFactory() {}
+    
+    /** {@inheritDoc} */
+    public final Value createValue(String value) {
+        return new SerialValue(createStringValue(value));
+    }
+
+    /** {@inheritDoc} */
+    public final Value createValue(String value, int type) throws ValueFormatException {
+        StatefullValue intValue;
+        switch (type) {
+            case PropertyType.BINARY:
+                intValue = createBinaryValue(value);
+                break;
+            case PropertyType.BOOLEAN:
+                intValue = createBooleanValue(value);
+                break;
+            case PropertyType.DATE:
+                intValue = createDateValue(value);
+                break;
+            case PropertyType.DOUBLE:
+                intValue = createDoubleValue(value);
+                break;
+            case PropertyType.LONG:
+                intValue = createLongValue(value);
+                break;
+            case PropertyType.NAME:
+                intValue = createNameValue(value);
+                break;
+            case PropertyType.PATH:
+                intValue = createPathValue(value);
+                break;
+            case PropertyType.REFERENCE:
+                intValue = createReferenceValue(value);
+                break;
+            case PropertyType.STRING:
+                intValue = createStringValue(value);
+                break;
+            default:
+                throw new ValueFormatException("Unknown type " + type);
+        }
+        
+        return new SerialValue(intValue);
+    }
+
+    /** {@inheritDoc} */
+    public final Value createValue(long value) {
+        return new SerialValue(createLongValue(value));
+    }
+
+    /** {@inheritDoc} */
+    public final Value createValue(double value) {
+        return new SerialValue(createDoubleValue(value));
+    }
+
+    /** {@inheritDoc} */
+    public final Value createValue(boolean value) {
+        return new SerialValue(createBooleanValue(value));
+    }
+
+    /** {@inheritDoc} */
+    public final Value createValue(Calendar value) {
+        return new SerialValue(createDateValue(value));
+    }
+
+    /** {@inheritDoc} */
+    public final Value createValue(InputStream value) {
+        return new SerialValue(createBinaryValue(value));
+    }
+
+    /** {@inheritDoc} */
+    public final Value createValue(Node value) throws RepositoryException {
+        return createValue(value.getUUID(), PropertyType.REFERENCE);
+    }
+    
+    //---------- API to overwrite to use extended classes ----------------------
+    
+    /**
+     * Creates an instance of the {@link StringValue} class or an extension
+     * thereof.
+     * <p>
+     * This implementation just calls {@link StringValue#StringValue(String)}
+     * with the string <code>value</code>.
+     * 
+     * @param value The string making up the value itself.
+     */
+    protected StringValue createStringValue(String value) {
+        return new StringValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link NameValue} class or an extension
+     * thereof.
+     * <p>
+     * This implementation just calls {@link NameValue#NameValue(String)}
+     * with the string <code>value</code>.
+     * 
+     * @param value The string making up the value itself.
+     * 
+     * @throws ValueFormatException if the string is not a synthactically
+     *      correct JCR name.
+     */
+    protected NameValue createNameValue(String value)
+            throws ValueFormatException {
+        return new NameValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link PathValue} class or an extension
+     * thereof.
+     * <p>
+     * This implementation just calls {@link PathValue#PathValue(String)}
+     * with the string <code>value</code>.
+     * 
+     * @param value The string making up the value itself.
+     * 
+     * @throws ValueFormatException if the string is not a synthactically
+     *      correct JCR path.
+     */
+    protected PathValue createPathValue(String value) 
+            throws ValueFormatException {
+        return new PathValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link ReferenceValue} class or an extension
+     * thereof.
+     * <p>
+     * This implementation just calls {@link ReferenceValue#ReferenceValue(String)}
+     * with the string <code>value</code>.
+     * 
+     * @param value The string making up the value itself.
+     * 
+     * @throws ValueFormatException if the string is not a synthactically
+     *      correct JCR reference.
+     */
+    protected ReferenceValue createReferenceValue(String value) 
+            throws ValueFormatException {
+        return new ReferenceValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link LongValue} class or an extension
+     * thereof.
+     * <p>
+     * This implementation just calls {@link LongValue#LongValue(long)}
+     * with the long <code>value</code>.
+     * 
+     * @param value The long making up the value itself.
+     */
+    protected LongValue createLongValue(long value) {
+        return new LongValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link LongValue} class or an extension
+     * thereof from the string representation of the <code>long</code> number.
+     * <p>
+     * This implementation just calls {@link LongValue#LongValue(String)} with
+     * the string <code>value</code>.
+     * 
+     * @param value The string representation of the <code>long</code> number
+     *      making up the value itself.
+     * 
+     * @throws ValueFormatException if the string cannot be converted to a
+     *      long number.
+     */
+    protected LongValue createLongValue(String value) throws ValueFormatException {
+        return new LongValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link DoubleValue} class or an extension
+     * thereof.
+     * <p>
+     * This implementation just calls {@link DoubleValue#DoubleValue(double)}
+     * with the double <code>value</code>.
+     * 
+     * @param value The double making up the value itself.
+     */
+    protected DoubleValue createDoubleValue(double value) {
+        return new DoubleValue(value);
+    }
+    
+    
+    /**
+     * Creates an instance of the {@link DoubleValue} class or an extension
+     * thereof from the string representation of the <code>double</code> number.
+     * <p>
+     * This implementation just calls {@link DoubleValue#DoubleValue(String)}
+     * with the string <code>value</code>.
+     * 
+     * @param value The string representation of the <code>long</code> number
+     *      making up the value itself.
+     * 
+     * @throws ValueFormatException if the string cannot be converted to a
+     *      double number.
+     */
+    protected DoubleValue createDoubleValue(String value) throws ValueFormatException {
+        return new DoubleValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link DateValue} class or an extension
+     * thereof.
+     * <p>
+     * This implementation just calls {@link DateValue#DateValue(Calendar)}
+     * with the <code>Calendar</code> <code>value</code>.
+     * 
+     * @param value The <code>Calendar</code> making up the value itself.
+     */
+    protected DateValue createDateValue(Calendar value) {
+        return new DateValue(value);
+    }
+    
+    
+    /**
+     * Creates an instance of the {@link DateValue} class or an extension
+     * thereof from the string representation of <code>Calendar</code>
+     * instance formatted as specified in the JCR specification.
+     * <p>
+     * This implementation just calls {@link DateValue#DateValue(String)} with
+     * the string <code>value</code>.
+     * 
+     * @param value The string representation of the <code>Calendar</code>
+     *      instance making up the value itself.
+     * 
+     * @throws ValueFormatException if the string cannot be converted to a
+     *      <code>Calendar</code> instance.
+     */
+    protected DateValue createDateValue(String value) throws ValueFormatException {
+        return new DateValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link BooleanValue} class or an extension
+     * thereof.
+     * <p>
+     * This implementation just calls {@link BooleanValue#BooleanValue(boolean)}
+     * with the boolean <code>value</code>.
+     * 
+     * @param value The boolean making up the value itself.
+     */
+    protected BooleanValue createBooleanValue(boolean value) {
+        return new BooleanValue(value);
+    }
+    
+    
+    /**
+     * Creates an instance of the {@link BooleanValue} class or an extension
+     * thereof from the string representation of the <code>boolean</code>.
+     * <p>
+     * This implementation just calls {@link BooleanValue#BooleanValue(String)}
+     * with the string <code>value</code>.
+     * 
+     * @param value The string representation of the <code>boolean</code>
+     *      making up the value itself.
+     * 
+     * @throws ValueFormatException if the string cannot be converted to a
+     *      long number.
+     */
+    protected BooleanValue createBooleanValue(String value) {
+        return new BooleanValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link BinaryValue} class or an extension
+     * thereof.
+     * <p>
+     * This implementation just calls {@link BinaryValue#BinaryValue(InputStream)}
+     * with the <code>InputStream</code> <code>value</code>.
+     * 
+     * @param value The <code>InputStream</code> making up the value itself.
+     */
+    protected BinaryValue createBinaryValue(InputStream value) {
+        return new BinaryValue(value);
+    }
+    
+    /**
+     * Creates an instance of the {@link BinaryValue} class or an extension
+     * thereof from the string whose UTF-8 representation is used as the
+     * binary data.
+     * <p>
+     * This implementation just calls {@link BinaryValue#BinaryValue(String)}
+     * with the string <code>value</code>.
+     * 
+     * @param value The string whose UTF-8 representation is making up the value
+     *      itself.
+     * 
+     * @throws ValueFormatException if the UTF-8 representation of the string
+     *      cannot be created.
+     */
+    protected BinaryValue createBinaryValue(String value) throws ValueFormatException {
+        return new BinaryValue(value);
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/SerialValueFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValue.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValue.java?rev=169297&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValue.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValue.java Mon May  9 04:55:17 2005
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.value;
+
+import java.io.InputStream;
+import java.util.Calendar;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.ValueFormatException;
+
+/**
+ * The <code>StatefullValue</code> interface defines the API used for the state
+ * classes used by the {@link org.apache.jackrabbit.value.SerialValue} class.
+ * <p>
+ * This interface resembles the JCR Value interface but is only used internally
+ * to the State pattern implementation of the
+ * {@link org.apache.jackrabbit.value.SerialValue} class.
+ * <p>
+ * This interface is not intended to be implemented by clients. Rather any of
+ * the concrete implementations of this class should be used or overwritten as
+ * appropriate.
+ * 
+ * @version $Revision$, $Date$
+ * @author Felix Meschberger
+ * @since 0.16.4.1
+ * 
+ * @see org.apache.jackrabbit.value.SerialValue
+ */
+public interface StatefullValue {
+
+    /**
+     * Returns access to the underlying value through an
+     * <code>InputStream</code>.
+     * 
+     * @throws ValueFormatException If a conversion of this value to an
+     *      <code>InputStream</code> is not possible.
+     * @throws IllegalStateException if the implementation is not in stream
+     *      providing state.
+     */
+    public InputStream getStream() throws ValueFormatException, RepositoryException;
+    
+    /**
+     * Returns the <code>boolean</code> representation of this value.
+     * 
+     * @throws ValueFormatException If a conversion of this value to the
+     *      boolean type is not possible.
+     * @throws IllegalStateException if the implementation is in stream
+     *      providing state.
+     */
+    public boolean getBoolean() throws ValueFormatException, RepositoryException;
+    
+    /**
+     * Returns the <code>Calendar</code> representation of this value.
+     * 
+     * @throws ValueFormatException If a conversion of this value to a
+     *      <code>Calendar</code> is not possible.
+     * @throws IllegalStateException if the implementation is in stream
+     *      providing state.
+     */
+    public Calendar getDate() throws ValueFormatException, RepositoryException;
+    
+    /**
+     * Returns the <code>double</code> representation of this value.
+     * 
+     * @throws ValueFormatException If a conversion of this value to the
+     *      double type is not possible.
+     * @throws IllegalStateException if the implementation is in stream
+     *      providing state.
+     */
+    public double getDouble() throws ValueFormatException, RepositoryException;
+    
+    /**
+     * Returns the <code>long</code> representation of this value.
+     * 
+     * @throws ValueFormatException If a conversion of this value to the
+     *      long type is not possible.
+     * @throws IllegalStateException if the implementation is in stream
+     *      providing state.
+     */
+    public long getLong() throws ValueFormatException, RepositoryException;
+    
+    /**
+     * Returns the <code>String</code> representation of this value.
+     * 
+     * @throws ValueFormatException If a conversion of this value to the
+     *      string type is not possible.
+     * @throws IllegalStateException if the implementation is in stream
+     *      providing state.
+     */
+    public String getString() throws ValueFormatException, RepositoryException;
+    
+    /**
+     * Returns the primary type of this value, which is one of the type
+     * codes defined in the <code>javax.jcr.PropertyType</code> interface.
+     */
+    public int getType();
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValueAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValueAdapter.java?rev=169297&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValueAdapter.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValueAdapter.java Mon May  9 04:55:17 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.value;
+
+import java.io.InputStream;
+import java.util.Calendar;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+
+/**
+ * The <code>StatefullValueAdapter</code> class 
+ * 
+ * @version $Revision$, $Date$
+ * @author fmeschbe
+ * @since 
+ */
+final class StatefullValueAdapter implements StatefullValue {
+
+    private final Value delegatee;
+    
+    StatefullValueAdapter(Value delegatee) {
+        this.delegatee = delegatee;
+    }
+
+    /** {@inheritDoc} */
+    public InputStream getStream() throws ValueFormatException, RepositoryException {
+        return delegatee.getStream();
+    }
+
+    /** {@inheritDoc} */
+    public boolean getBoolean() throws ValueFormatException, RepositoryException {
+        return delegatee.getBoolean();
+    }
+
+    /** {@inheritDoc} */
+    public Calendar getDate() throws ValueFormatException, RepositoryException {
+        return delegatee.getDate();
+    }
+
+    /** {@inheritDoc} */
+    public double getDouble() throws ValueFormatException, RepositoryException {
+        return delegatee.getDouble();
+    }
+
+    /** {@inheritDoc} */
+    public long getLong() throws ValueFormatException, RepositoryException {
+        return delegatee.getLong();
+    }
+
+    /** {@inheritDoc} */
+    public String getString() throws ValueFormatException, RepositoryException {
+        return delegatee.getString();
+    }
+
+    /** {@inheritDoc} */
+    public int getType() {
+        return delegatee.getType();
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StatefullValueAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StringValue.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StringValue.java?rev=169297&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StringValue.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StringValue.java Mon May  9 04:55:17 2005
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.value;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.Calendar;
+
+import javax.jcr.PropertyType;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+
+/**
+ * The <code>StringValue</code> class implements the committed value state for
+ * String values as a part of the State design pattern (Gof) used by this
+ * package. 
+ * 
+ * @version $Revision$, $Date$
+ * @author Jukka Zitting
+ * @since 0.16.4.1
+ * 
+ * @see org.apache.jackrabbit.value.SerialValue
+ */
+public class StringValue extends BaseNonStreamValue {
+
+    /** The string value */
+    private final String value;
+
+    /**
+     * Creates an instance for the given string <code>value</code>.
+     */
+    protected StringValue(String value) {
+        this.value = value;
+    }
+
+    /**
+     * Returns <code>PropertyType.STRING</code>.
+     */
+    public int getType() {
+        return PropertyType.STRING;
+    }
+
+    /**
+     * Returns the string value.
+     */
+    public String getString() {
+        return value;
+    }
+
+    /**
+     * Returns the string value parsed to a long calling the
+     * <code>Long.valueOf(String)</code> method.
+     * 
+     * @throws ValueFormatException if the string cannot be parsed to long.
+     */
+    public long getLong() throws ValueFormatException {
+        return LongValue.toLong(value);
+    }
+
+    /**
+     * Returns the string value parsed to a double calling the
+     * <code>Double.valueOf(String)</code> method.
+     * 
+     * @throws ValueFormatException if the string cannot be parsed to double.
+     */
+    public double getDouble() throws ValueFormatException {
+        return DoubleValue.toDouble(value);
+    }
+
+    /**
+     * Returns the string value parsed to a <code>Calendar</code> using the
+     * same formatter as the {@link DateValue} class. This formatting bears the
+     * same issues as parsing and formatting that class.
+     * 
+     * @throws ValueFormatException if the string cannot be parsed into a
+     *      <code>Calendar</code> instance.
+     */
+    public Calendar getDate() throws ValueFormatException {
+        return DateValue.toCalendar(value);
+    }
+
+    /**
+     * Returns the string value parsed to a boolean calling the
+     * <code>Boolean.valueOf(String)</code> method.
+     */
+    public boolean getBoolean() {
+        return BooleanValue.toBoolean(value);
+    }
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/StringValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/doc-files/sequence.uxf
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/doc-files/sequence.uxf?rev=169297&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/doc-files/sequence.uxf (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/doc-files/sequence.uxf Mon May  9 04:55:17 2005
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?><umlet_diagram><element><type>com.umlet.element.base.Relation</type><coordinates><x>790</x><y>30</y><w>40</w><h>500</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;480</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>680</x><y>30</y><w>40</w><h>500</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;480</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>240</x><y>30</y><w>40</w><h>490</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;470</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>70</x><y>30</y><w>40</w><h>490</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;470</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>410</x><y>30</y><w>40</w><h>500</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;480</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>570</x><y>30</y><w>40</w><h>500</h></coordinates><panel_attributes>lt=.</panel_attributes><additional_attributes>20;20;20;480</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>80</x><y>446</y><w>360</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+InputStream</panel_attributes><additional_attributes>20;34;340;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>420</x><y>436</y><w>400</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+InputStream</panel_attributes><additional_attributes>20;34;380;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>80</x><y>356</y><w>360</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+InputStream</panel_attributes><additional_attributes>20;34;340;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>580</x><y>326</y><w>240</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+InputStream</panel_attributes><additional_attributes>20;34;220;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>800</x><y>440</y><w>20</w><h>40</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>420</x><y>406</y><w>400</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+getStream()</panel_attributes><additional_attributes>380;34;20;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>580</x><y>296</y><w>240</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+getStream()</panel_attributes><additional_attributes>220;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>800</x><y>330</y><w>20</w><h>40</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>80</x><y>396</y><w>360</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+getStream()</panel_attributes><additional_attributes>340;34;20;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>80</x><y>186</y><w>360</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+getStream()</panel_attributes><additional_attributes>340;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>420</x><y>430</y><w>20</w><h>60</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>420</x><y>336</y><w>180</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+InputStream</panel_attributes><additional_attributes>20;34;160;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>420</x><y>220</y><w>20</w><h>180</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>80</x><y>60</y><w>20</w><h>430</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>580</x><y>230</y><w>20</w><h>150</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>430</x><y>300</y><w>20</w><h>20</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>430</x><y>266</y><w>170</w><h>71</h></coordinates><panel_attributes>lt=&lt;&lt;-
+setValue
+(BinaryValue)</panel_attributes><additional_attributes>20;34;150;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>580</x><y>246</y><w>240</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+new BinaryValue(String)</panel_attributes><additional_attributes>220;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>800</x><y>280</y><w>20</w><h>20</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>250</x><y>56</y><w>460</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+new StringValue(String)</panel_attributes><additional_attributes>440;34;20;34</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>760</x><y>20</y><w>100</w><h>30</h></coordinates><panel_attributes>BinaryValue</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>580</x><y>206</y><w>130</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+getString()</panel_attributes><additional_attributes>110;34;20;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>420</x><y>196</y><w>180</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+getStream()</panel_attributes><additional_attributes>160;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>690</x><y>90</y><w>20</w><h>20</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>80</x><y>136</y><w>190</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+GeneralValue</panel_attributes><additional_attributes>20;34;170;34</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>650</x><y>20</y><w>100</w><h>30</h></coordinates><panel_attributes>StringValue</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>540</x><y>20</y><w>100</w><h>30</h></coordinates><panel_attributes>InitialValue</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>380</x><y>20</y><w>100</w><h>30</h></coordinates><panel_attributes>GeneralValue</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>580</x><y>140</y><w>20</w><h>20</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>420</x><y>130</y><w>20</w><h>30</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>420</x><y>106</y><w>180</w><h>71</h></coordinates><panel_attributes>lt=&lt;&lt;-
+new InitialValue
+(StringValue)</panel_attributes><additional_attributes>160;34;20;34</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>250</x><y>96</y><w>190</w><h>71</h></coordinates><panel_attributes>lt=&lt;&lt;-
+new GeneralValue
+(StringValue)</panel_attributes><additional_attributes>170;34;20;34</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>40</x><y>20</y><w>100</w><h>30</h></coordinates><panel_attributes>Client</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>190</x><y>20</y><w>140</w><h>30</h></coordinates><panel_attributes>SerialValueFactory</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>250</x><y>70</y><w>20</w><h>110</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>80</x><y>36</y><w>190</w><h>54</h></coordinates><panel_attributes>lt=&lt;&lt;-
+createValue(String)</panel_attributes><additional_attributes>170;34;20;34</additional_attributes></element><element><type>com.umlet.element.custom.SeqObjectActive</type><coordinates><x>690</x><y>240</y><w>20</w><h>20</h></coordinates><panel_attributes></panel_attributes><additional_attributes></additional_attributes></element></umlet_diagram>
\ No newline at end of file

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/doc-files/state.uxf
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/doc-files/state.uxf?rev=169297&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/doc-files/state.uxf (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/doc-files/state.uxf Mon May  9 04:55:17 2005
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><umlet_diagram><element><type>com.umlet.element.base.Relation</type><coordinates><x>40</x><y>90</y><w>90</w><h>80</h></coordinates><panel_attributes>lt=&lt;-</panel_attributes><additional_attributes>20;60;20;40;70;40;70;20</additional_attributes></element><element><type>com.umlet.element.custom.State</type><coordinates><x>150</x><y>150</y><w>100</w><h>40</h></coordinates><panel_attributes>non-stream</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.custom.State</type><coordinates><x>10</x><y>150</y><w>100</w><h>40</h></coordinates><panel_attributes>stream</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>130</x><y>90</y><w>90</w><h>80</h></coordinates><panel_attributes>lt=&lt;-</panel_attributes><additional_attributes>70;60;70;40;20;40;20;20</additional_attributes></element><element><type>com.umlet.element.custom.State</type><coordinates><x>80</x><y>70</y><w>100</w><h>40</h></coordinates><panel_attributes>initial</panel_attributes><additional_attributes></additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>110</x><y>20</y><w>40</w><h>70</h></coordinates><panel_attributes>lt=&lt;-</panel_attributes><additional_attributes>20;50;20;20</additional_attributes></element><element><type>com.umlet.element.custom.InitialState</type><coordinates><x>120</x><y>20</y><w>20</w><h>20</h></coordinates><panel_attributes>i</panel_attributes><additional_attributes></additional_attributes></element></umlet_diagram>
\ No newline at end of file

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/package.html
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/package.html?rev=169297&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/package.html (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/package.html Mon May  9 04:55:17 2005
@@ -0,0 +1,65 @@
+<html>
+<body>
+Serializable implementation of the JCR Value interfaces.
+<p>
+This package contains a simple implementation of the JCR
+{@link javax.jcr.Value Value} and {@link javax.jcr.ValueFactory ValueFactory}
+interfaces. The implementation has no external dependencies and supports
+serialization of Value instances.
+</p>
+<p>
+Note that the Value instances created by this package are not thread safe.
+</p>
+<h2>Implementation notes</h2>
+<p>
+This package uses the State design pattern (GoF) to implement the JCR
+{@link javax.jcr.Value Value} interface. A Value instance is initially
+in a fresh state that gets committed to a stream or non-stream state once
+the first value getter method is invoked. After that the Value state is
+no longer changed. The state diagram below illustrates the Value states.
+</p>
+<p align="center">
+<img src="doc-files/state.jpg" alt="Value state diagram">
+</p>
+<p>
+The {@link GeneralValue GeneralValue} implementation class acts as the
+state context object. It contains a reference to another Value instance that
+represents the current Value state. The reference is initially set to
+an {@link InitialValue InitialValue} instance that is used to intercept
+the first value getter method. When the first method call is made, the
+InitialValue instance performs the correct state transition by changing
+the GenericValue state reference to a committed Value instance.
+</p>
+<p>
+The committed Value states are implemented by the type-specific classes
+{@link StringValue StringValue}, {@link LongValue LongValue},
+{@link DoubleValue DoubleValue}, {@link BooleanValue BooleanValue},
+{@link DateValue DateValue}, and {@link BinaryValue BinaryValue}.
+These classes handle no state transitions, but implement the value
+conversion rules defined in the JCR specification.
+</p>
+<p>
+The sequence diagram below illustrates the sequence of actions of
+creating a string value, committing it to the stream state, and finally
+using it in that state.
+</p>
+<p align="center">
+<img src="doc-files/sequence.jpg" alt="Value sequence diagram">
+</p>
+<p>
+These implementation classes are all package-local and final, and their
+behaviour can therefore not be modified externally. The Decorator design
+pattern should be used if changes to Value behaviour are needed.
+</p>
+<h2>About Value equality</h2>
+<p>
+The current JCR specification (0.16.4) does not define a safe mechanism for
+implementing the {@link Object#equals(Object) equals} method in general.
+A proper implementation of this method would currently require potential
+state changes in the compared Value instances. Thus this package only defines
+equality comparisons between Value instances generated by this package and
+throws {@link UnsupportedOperationException UnsupportedOperationExceptions}
+for more general Value comparisons.
+</p>
+</body>
+</html>

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/value/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java?rev=169297&r1=169296&r2=169297&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java Mon May  9 04:55:17 2005
@@ -217,6 +217,7 @@
         ignoreMethod("getImportContentHandler"); // implemented locally
         ignoreMethod("exportSystemView");        // multiple methods
         ignoreMethod("exportDocumentView");      // multiple method
+        ignoreMethod("getValueFactory");         // implemented locally
 
         Session session = (Session) mock;
         RemoteSession remote = remoteFactory.getRemoteSession(session);



Mime
View raw message