jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r165161 - in /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: SessionImpl.java value/ValueFactoryImpl.java
Date Thu, 28 Apr 2005 16:33:22 GMT
Author: stefan
Date: Thu Apr 28 09:33:21 2005
New Revision: 165161

URL: http://svn.apache.org/viewcvs?rev=165161&view=rev
Log:
port to jcr api v0.16.4.1

Added:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/value/ValueFactoryImpl.java
  (with props)
Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java?rev=165161&r1=165160&r2=165161&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java Thu Apr
28 09:33:21 2005
@@ -74,6 +74,7 @@
 import org.apache.jackrabbit.core.xml.ImportHandler;
 import org.apache.jackrabbit.core.xml.SessionImporter;
 import org.apache.jackrabbit.core.xml.SysViewSAXEventGenerator;
+import org.apache.jackrabbit.core.value.ValueFactoryImpl;
 import org.apache.log4j.Logger;
 import org.apache.xml.serialize.OutputFormat;
 import org.apache.xml.serialize.XMLSerializer;
@@ -180,6 +181,11 @@
     protected final Set lockTokens = new HashSet();
 
     /**
+     * value factory
+     */
+    protected ValueFactory valueFactory;
+
+    /**
      * Protected constructor.
      *
      * @param rep
@@ -1146,7 +1152,10 @@
      */
     public ValueFactory getValueFactory() 
             throws UnsupportedRepositoryOperationException, RepositoryException {
-        return null;  // @todo implement
+        if (valueFactory == null) {
+            valueFactory = new ValueFactoryImpl();
+        }
+        return valueFactory;
     }
 
     /**

Added: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/value/ValueFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/value/ValueFactoryImpl.java?rev=165161&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/value/ValueFactoryImpl.java
(added)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/value/ValueFactoryImpl.java
Thu Apr 28 09:33:21 2005
@@ -0,0 +1,97 @@
+/*
+ * 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.core.value;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+import java.io.InputStream;
+import java.util.Calendar;
+
+/**
+ * This class implements the  <code>ValueFactory</code> interface.
+ *
+ * @see javax.jcr.Session#getValueFactory()
+ */
+public class ValueFactoryImpl implements ValueFactory {
+
+    /**
+     * Constructs a <code>ValueFactory</code> object.
+     */
+    public ValueFactoryImpl() {
+    }
+
+    //---------------------------------------------------------< ValueFactory >
+    /**
+     * {@inheritDoc}
+     */
+    public Value createValue(boolean value) {
+        return new BooleanValue(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Value createValue(Calendar value) {
+        return new DateValue(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Value createValue(double value) {
+        return new DoubleValue(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Value createValue(InputStream value) {
+        return new BinaryValue(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Value createValue(long value) {
+        return new LongValue(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Value createValue(Node value) throws RepositoryException {
+        return new ReferenceValue(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Value createValue(String value) {
+        return new StringValue(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Value createValue(String value, int type)
+            throws ValueFormatException {
+        return ValueHelper.convert(value, type);
+    }
+}

Propchange: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/value/ValueFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message