Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 9457 invoked from network); 29 Apr 2009 17:13:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Apr 2009 17:13:40 -0000 Received: (qmail 83231 invoked by uid 500); 29 Apr 2009 17:13:40 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 83176 invoked by uid 500); 29 Apr 2009 17:13:40 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 83167 invoked by uid 99); 29 Apr 2009 17:13:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 17:13:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 17:13:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 51110238895F; Wed, 29 Apr 2009 17:13:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r769837 - in /jackrabbit/trunk: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ Date: Wed, 29 Apr 2009 17:13:15 -0000 To: commits@jackrabbit.apache.org From: reschke@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090429171316.51110238895F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: reschke Date: Wed Apr 29 17:13:15 2009 New Revision: 769837 URL: http://svn.apache.org/viewvc?rev=769837&view=rev Log: JCR-1609: add missing methods to new property types to o.a.j.api.jsr283.Node, add method stubs in -core. Added: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Binary.java (with props) Modified: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Added: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Binary.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Binary.java?rev=769837&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Binary.java (added) +++ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Binary.java Wed Apr 29 17:13:15 2009 @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.api.jsr283; + +import java.io.InputStream; +import java.io.IOException; + +import javax.jcr.Property; +import javax.jcr.RepositoryException; +import javax.jcr.Value; +import javax.jcr.ValueFactory; + +/** + * A Binary object holds a JCR property value of type + * BINARY. The Binary interface and the related + * methods in {@link Property}, {@link Value} and {@link ValueFactory} replace + * the deprecated {@link Value#getStream} and {@link Property#getStream} + * methods. + * + * @since JCR 2.0 + */ +public interface Binary { + + /** + * Returns an {@link InputStream} representation of this value. Each call to + * getStream() returns a new stream. The API consumer is + * responsible for calling close() on the returned stream. + * + * @return A stream representation of this value. + * + * @throws RepositoryException if an error occurs. + */ + InputStream getStream() throws RepositoryException; + + /** + * Reads successive bytes from the specified position in this + * Binary into the passed byte array until either the byte + * array is full or the end of the Binary is encountered. + * + * @param b the buffer into which the data is read. + * @param position the position in this Binary from which to start reading + * bytes. + * + * @return the number of bytes read into the buffer, or -1 if there is no + * more data because the end of the Binary has been reached. + * + * @throws IOException if an I/O error occurs. + * @throws NullPointerException if b is null. + * @throws IllegalArgumentException if offset is negative. + * @throws RepositoryException if another error occurs. + */ + int read(byte[] b, long position) throws IOException, RepositoryException; + + /** + * Returns the size of this Binary value in bytes. + * + * @return the size of this value in bytes. + * + * @throws RepositoryException if an error occurs. + */ + long getSize() throws RepositoryException; +} \ No newline at end of file Propchange: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Binary.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Binary.java ------------------------------------------------------------------------------ svn:executable = * Propchange: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Binary.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Modified: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java?rev=769837&r1=769836&r2=769837&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java (original) +++ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jsr283/Node.java Wed Apr 29 17:13:15 2009 @@ -16,10 +16,15 @@ */ package org.apache.jackrabbit.api.jsr283; +import java.math.BigDecimal; + import javax.jcr.NodeIterator; +import javax.jcr.Property; import javax.jcr.RepositoryException; import javax.jcr.PropertyIterator; import javax.jcr.UnsupportedRepositoryOperationException; +import javax.jcr.Value; +import javax.jcr.ValueFormatException; import javax.jcr.lock.LockException; import javax.jcr.nodetype.ConstraintViolationException; import javax.jcr.nodetype.NoSuchNodeTypeException; @@ -181,6 +186,60 @@ public void setPrimaryType(String nodeTypeName) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException; /** + * The behavior of this method is identical to that of {@link + * #setProperty(String name, Value value)} except that the value is + * specified as a {@link BigDecimal} and, if possible, the type assigned to + * the property is DECIMAL, otherwise a best-effort conversion + * is attempted. + * + * @param name The name of a property of this node + * @param value The value to assigned + * + * @return The updated Property object + * + * @throws ValueFormatException if value cannot be converted to + * the type of the specified property or if the property already exists and + * is multi-valued. + * @throws VersionException if this node is read-only due to a checked-in node and + * this implementation performs this validation immediately. + * @throws LockException if a lock prevents the setting of the property and + * this implementation performs this validation immediately. + * @throws ConstraintViolationException if the change would violate a + * node-type or other constraint and this implementation performs this + * validation immediately. + * @throws RepositoryException if another error occurs. + * @since JCR 2.0 + */ + public Property setProperty(String name, BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; + + /** + * The behavior of this method is identical to that of {@link + * #setProperty(String name, Value value)} except that the value is + * specified as a {@link Binary} and, if possible, the type assigned to the + * property is BINARY, otherwise a best-effort conversion is + * attempted. + * + * @param name The name of a property of this node + * @param value The value to assigned + * + * @return The updated Property object + * + * @throws ValueFormatException if value cannot be converted to + * the type of the specified property or if the property already exists and + * is multi-valued. + * @throws VersionException if this node is read-only due to a checked-in node and + * this implementation performs this validation immediately. + * @throws LockException if a lock prevents the setting of the property and + * this implementation performs this validation immediately. + * @throws ConstraintViolationException if the change would violate a + * node-type or other constraint and this implementation performs this + * validation immediately. + * @throws RepositoryException if another error occurs. + * @since JCR 2.0 + */ + public Property setProperty(String name, Binary value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; + + /** * Returns an iterator over all nodes that are in the shared set of this * node. If this node is not shared then the returned iterator contains * only this node. Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=769837&r1=769836&r2=769837&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Wed Apr 29 17:13:15 2009 @@ -57,7 +57,7 @@ import org.apache.jackrabbit.util.ChildrenCollectorFilter; import org.apache.jackrabbit.uuid.UUID; import org.apache.jackrabbit.value.ValueHelper; -import org.apache.jackrabbit.api.jsr283.InvalidLifecycleTransitionException; +import org.apache.jackrabbit.api.jsr283.Binary; import org.apache.jackrabbit.api.jsr283.version.VersionManager; import org.apache.jackrabbit.api.jsr283.lock.LockManager; import org.slf4j.Logger; @@ -95,6 +95,7 @@ import javax.jcr.version.VersionHistory; import javax.jcr.version.VersionIterator; import java.io.InputStream; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; @@ -1690,6 +1691,16 @@ return prop; } + public Property setProperty(String name, BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException { + // TODO + throw new RuntimeException("Not implemented yet, see JCR-1609"); + } + + public Property setProperty(String name, Binary value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException { + // TODO + throw new RuntimeException("Not implemented yet, see JCR-1609"); + } + /** * @see ItemImpl#getQName() */ @@ -4827,5 +4838,4 @@ public String toString() { return "node " + super.toString(); } - }