You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2013/08/21 20:36:17 UTC
svn commit: r1516250 [1/4] - in /chemistry/opencmis/trunk:
chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/
chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/ap...
Author: fmui
Date: Wed Aug 21 18:36:15 2013
New Revision: 1516250
URL: http://svn.apache.org/r1516250
Log:
more code clean up
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/QueryStatement.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CXFPortProvider.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/PropertyDefinition.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/RelationshipTypeDefinition.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/CappedInputStream.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrBinary.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrConverter.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrDocument.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrFolder.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrNode.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrPrivateWorkingCopy.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrRepository.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrTypeManager.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrUnversionedDocument.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersion.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersionBase.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PathManager.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PropertyHelper.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/AbstractJcrTypeHandler.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentIdentifierMap.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultDocumentTypeHandler.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultFolderTypeHandler.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/Evaluator.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/EvaluatorXPath.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/ParseTreeWalker.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/QueryTranslator.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/XPathBuilder.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/type/JcrDocumentTypeHandler.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/type/JcrFolderTypeHandler.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/type/JcrTypeHandler.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/type/JcrTypeHandlerManager.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/util/FilterIterator.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/util/ISO8601.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/util/Iterables.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/util/Predicate.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/util/Util.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/TestParameters.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/repository/ObjectGenerator.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AclEditorFrame.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ACLTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/PolicyTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/PropertyTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RelationshipTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RenditionTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/QueryStatement.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/QueryStatement.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/QueryStatement.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/QueryStatement.java Wed Aug 21 18:36:15 2013
@@ -35,7 +35,8 @@ import org.apache.chemistry.opencmis.com
* Calendar cal = ...
* Folder folder = ...
*
- * QueryStatement qs = session.createQueryStatement("SELECT ?, ? FROM ? WHERE ? > TIMESTAMP ? AND IN_FOLDER(?) OR ? IN (?)");
+ * QueryStatement qs =
+ * session.createQueryStatement("SELECT ?, ? FROM ? WHERE ? > TIMESTAMP ? AND IN_FOLDER(?) OR ? IN (?)");
*
* qs.setProperty(1, "cmis:document", "cmis:name");
* qs.setProperty(2, "cmis:document", "cmis:objectId");
@@ -94,31 +95,25 @@ public interface QueryStatement extends
void setStringLike(int parameterIndex, String str);
/**
- * Sets the designated parameter to the given string in a CMIS contains statement.
- * Note that the CMIS specification requires two levels of escaping. The first level
- * escapes ', ", \ characters to \', \" and \\. The characters *, ? and - are
- * interpreted as text search operators and are not escaped on first level. If *, ?, -
- * shall be used as literals, they must be passed escaped with \*, \? and \- to
- * this method.
+ * Sets the designated parameter to the given string in a CMIS contains
+ * statement. Note that the CMIS specification requires two levels of
+ * escaping. The first level escapes ', ", \ characters to \', \" and \\.
+ * The characters *, ? and - are interpreted as text search operators and
+ * are not escaped on first level. If *, ?, - shall be used as literals,
+ * they must be passed escaped with \*, \? and \- to this method.
*
* For all statements in a CONTAINS() clause it is required to isolate those
- * from a query statement. Therefore a second level escaping is performed. On
- * the second level grammar ", ', - and \ are escaped with a \. See the spec for
- * further details.
- *
- * Summary (input --> first level escaping --> second level escaping and output):
- * * --> * --> *
- * ? --> ? --> ?
- * - --> - --> -
- * \ --> \\ --> \\\\ (for any other character following other than * ? -)
- * \* --> \* --> \\*
- * \? --> \? --> \\?
- * \- --> \- --> \\-
- * ' --> \' --> \\\'
- * " --> \" --> \\\"
+ * from a query statement. Therefore a second level escaping is performed.
+ * On the second level grammar ", ', - and \ are escaped with a \. See the
+ * spec for further details.
+ *
+ * Summary (input --> first level escaping --> second level escaping and
+ * output): * --> * --> * ? --> ? --> ? - --> - --> - \ --> \\ --> \\\\ (for
+ * any other character following other than * ? -) \* --> \* --> \\* \? -->
+ * \? --> \\? \- --> \- --> \\- ' --> \' --> \\\' " --> \" --> \\\"
*/
void setStringContains(int parameterIndex, String str);
-
+
/**
* Sets the designated parameter to the given object id.
*/
@@ -153,19 +148,22 @@ public interface QueryStatement extends
* Sets the designated parameter to the given DateTime value.
*/
void setDateTime(int parameterIndex, long... ms);
-
+
/**
- * Sets the designated parameter to the given DateTime value with the prefix 'TIMESTAMP '.
+ * Sets the designated parameter to the given DateTime value with the prefix
+ * 'TIMESTAMP '.
*/
void setDateTimeTimestamp(int parameterIndex, Calendar... cal);
/**
- * Sets the designated parameter to the given DateTime value with the prefix 'TIMESTAMP '.
+ * Sets the designated parameter to the given DateTime value with the prefix
+ * 'TIMESTAMP '.
*/
void setDateTimeTimestamp(int parameterIndex, Date... date);
/**
- * Sets the designated parameter to the given DateTime value with the prefix 'TIMESTAMP '.
+ * Sets the designated parameter to the given DateTime value with the prefix
+ * 'TIMESTAMP '.
*/
void setDateTimeTimestamp(int parameterIndex, long... ms);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java Wed Aug 21 18:36:15 2013
@@ -32,20 +32,20 @@ import org.apache.chemistry.opencmis.com
*/
public class CmisBindingFactory {
- /** Default CMIS AtomPub binding SPI implementation */
+ /** Default CMIS AtomPub binding SPI implementation. */
public static final String BINDING_SPI_ATOMPUB = "org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubSpi";
- /** Default CMIS Web Services binding SPI implementation */
+ /** Default CMIS Web Services binding SPI implementation. */
public static final String BINDING_SPI_WEBSERVICES = "org.apache.chemistry.opencmis.client.bindings.spi.webservices.CmisWebServicesSpi";
- /** Default CMIS Browser binding SPI implementation */
+ /** Default CMIS Browser binding SPI implementation. */
public static final String BINDING_SPI_BROWSER = "org.apache.chemistry.opencmis.client.bindings.spi.browser.CmisBrowserBindingSpi";
- /** Default CMIS local binding SPI implementation */
+ /** Default CMIS local binding SPI implementation. */
public static final String BINDING_SPI_LOCAL = "org.apache.chemistry.opencmis.client.bindings.spi.local.CmisLocalSpi";
- /** Default HTTP invoker class */
+ /** Default HTTP invoker clas.s */
public static final String DEFAULT_HTTP_INVOKER = "org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker";
- /** Standard authentication provider class */
+ /** Standard authentication provider class. */
public static final String STANDARD_AUTHENTICATION_PROVIDER = "org.apache.chemistry.opencmis.client.bindings.spi.StandardAuthenticationProvider";
- /** NTLM authentication provider class */
+ /** NTLM authentication provider class. */
public static final String NTLM_AUTHENTICATION_PROVIDER = "org.apache.chemistry.opencmis.client.bindings.spi.NTLMAuthenticationProvider";
private Map<String, String> defaults;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/Cache.java Wed Aug 21 18:36:15 2013
@@ -63,7 +63,7 @@ public interface Cache extends Serializa
* @param keys
* the keys
* @return the object or
- * <code>null<code> if the branch or leaf doesn't exist
+ * <code>null</code> if the branch or leaf doesn't exist
*/
Object get(String... keys);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/ClientVersion.java Wed Aug 21 18:36:15 2013
@@ -18,8 +18,8 @@
*/
package org.apache.chemistry.opencmis.client.bindings.impl;
-public class ClientVersion {
-
+public final class ClientVersion {
+
public static final String OPENCMIS_VERSION;
public static final String OPENCMIS_CLIENT;
@@ -33,4 +33,7 @@ public class ClientVersion {
OPENCMIS_CLIENT = "Apache Chemistry OpenCMIS/" + (OPENCMIS_VERSION == null ? "?" : OPENCMIS_VERSION);
}
}
+
+ private ClientVersion() {
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractWebServicesService.java Wed Aug 21 18:36:15 2013
@@ -125,6 +125,7 @@ public abstract class AbstractWebService
return new CmisUpdateConflictException(msg, code, errorContent);
case VERSIONING:
return new CmisVersioningException(msg, code, errorContent);
+ default:
}
return new CmisRuntimeException("Unknown exception[" + ex.getFaultInfo().getType().value() + "]: " + msg);
@@ -141,6 +142,7 @@ public abstract class AbstractWebService
transformrt.transform(new DOMSource(node), new StreamResult(sw));
return sw.toString();
} catch (TransformerException e) {
+ assert false;
}
return "";
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CXFPortProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CXFPortProvider.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CXFPortProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CXFPortProvider.java Wed Aug 21 18:36:15 2013
@@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
/**
- * Apache CXF JAX-WS implementation
+ * Apache CXF JAX-WS implementation.
*/
public class CXFPortProvider extends AbstractPortProvider {
private static final Logger LOG = LoggerFactory.getLogger(CXFPortProvider.class);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.java Wed Aug 21 18:36:15 2013
@@ -20,12 +20,12 @@ package org.apache.chemistry.opencmis.cl
/**
- * CMIS Collection Iterable
+ * CMIS Collection Iterable.
*/
public class CollectionIterable<T> extends AbstractIterable<T> {
/**
- * Construct
+ * Constructor.
*
* @param pageFetcher
*/
@@ -34,7 +34,7 @@ public class CollectionIterable<T> exten
}
/**
- * Construct
+ * Constructor.
*
* @param position
* @param pageFetcher
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.java Wed Aug 21 18:36:15 2013
@@ -20,12 +20,12 @@ package org.apache.chemistry.opencmis.cl
/**
- * Iterable for a CMIS Collection Page
+ * Iterable for a CMIS Collection Page.
*/
public class CollectionPageIterable<T> extends AbstractIterable<T> {
/**
- * Construct
+ * Constructor.
*
* @param pageFetcher
*/
@@ -34,7 +34,7 @@ public class CollectionPageIterable<T> e
}
/**
- * Construct
+ * Constructor.
*
* @param position
* @param pageFetcher
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java Wed Aug 21 18:36:15 2013
@@ -502,7 +502,7 @@ public final class SessionParameter {
public static final String PASSWORD = "org.apache.chemistry.opencmis.password";
// --- binding parameter ----
- /** Predefined binding types (see {@code BindingType}) */
+ /** Predefined binding types (see {@code BindingType}). */
public static final String BINDING_TYPE = "org.apache.chemistry.opencmis.binding.spi.type";
/** Class name of the binding class. */
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/PropertyDefinition.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/PropertyDefinition.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/PropertyDefinition.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/PropertyDefinition.java Wed Aug 21 18:36:15 2013
@@ -118,7 +118,7 @@ public interface PropertyDefinition<T> e
* Returns if the property is inherited by a parent type.
*
* @return <code>true</code> - is inherited;
- * <code>false</false> - is not inherited; <code>null</code> -
+ * <code>false</code> - is not inherited; <code>null</code> -
* unknown (noncompliant repository)
*
* @cmis 1.0
@@ -129,7 +129,7 @@ public interface PropertyDefinition<T> e
* Returns if the property is required.
*
* @return <code>true</code> - is required;
- * <code>false</false> - is not required; <code>null</code> -
+ * <code>false</code> - is not required; <code>null</code> -
* unknown (noncompliant repository)
*
* @cmis 1.0
@@ -140,7 +140,7 @@ public interface PropertyDefinition<T> e
* Returns if the property is queryable.
*
* @return <code>true</code> - is queryable;
- * <code>false</false> - is not queryable; <code>null</code> -
+ * <code>false</code> - is not queryable; <code>null</code> -
* unknown (noncompliant repository)
*
* @cmis 1.0
@@ -151,7 +151,7 @@ public interface PropertyDefinition<T> e
* Returns if the property is Orderable.
*
* @return <code>true</code> - is Orderable;
- * <code>false</false> - is not Orderable; <code>null</code> -
+ * <code>false</code> - is not Orderable; <code>null</code> -
* unknown (noncompliant repository)
*
* @cmis 1.0
@@ -162,7 +162,7 @@ public interface PropertyDefinition<T> e
* Returns if the property supports open choice.
*
* @return <code>true</code> - supports open choice;
- * <code>false</false> - does not support open choice; <code>null</code>
+ * <code>false</code> - does not support open choice; <code>null</code>
* - unknown or not applicable
*
* @cmis 1.0
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/RelationshipTypeDefinition.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/RelationshipTypeDefinition.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/RelationshipTypeDefinition.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/definitions/RelationshipTypeDefinition.java Wed Aug 21 18:36:15 2013
@@ -30,7 +30,7 @@ public interface RelationshipTypeDefinit
/**
* Returns the list of type ids that are allowed as source objects.
*
- * @return list of type ids or <code>null</null> if all types are allowed
+ * @return list of type ids or <code>null</code> if all types are allowed
*
* @cmis 1.0
*/
@@ -39,7 +39,7 @@ public interface RelationshipTypeDefinit
/**
* Returns the list of type ids that are allowed as target objects.
*
- * @return list of type ids or <code>null</null> if all types are allowed
+ * @return list of type ids or <code>null</code> if all types are allowed
*
* @cmis 1.0
*/
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.java Wed Aug 21 18:36:15 2013
@@ -323,7 +323,7 @@ public final class Base64 {
* <b>and</b> URLSAFE in which case one of them will be picked, though there
* is no guarantee as to which one will be picked.
*/
- private static final byte[] getAlphabet(int options) {
+ private static byte[] getAlphabet(int options) {
if ((options & URL_SAFE) == URL_SAFE) {
return _URL_SAFE_ALPHABET;
} else if ((options & ORDERED) == ORDERED) {
@@ -339,7 +339,7 @@ public final class Base64 {
* URL_SAFE in which case one of them will be picked, though there is no
* guarantee as to which one will be picked.
*/
- private static final byte[] getDecodabet(int options) {
+ private static byte[] getDecodabet(int options) {
if ((options & URL_SAFE) == URL_SAFE) {
return _URL_SAFE_DECODABET;
} else if ((options & ORDERED) == ORDERED) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java Wed Aug 21 18:36:15 2013
@@ -2831,6 +2831,7 @@ public final class JSONConverter {
return cal;
}
throw new CmisRuntimeException("Invalid DateTime value!");
+ default:
}
throw new CmisRuntimeException("Unkown property type!");
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java Wed Aug 21 18:36:15 2013
@@ -441,11 +441,10 @@ public final class MimeHelper {
throw new ParseException("Invalid escape character");
}
value.append(header.charAt(i));
- }
- // line breaks are ignored, except for naked '\n' characters,
- // which are consider
- // parts of linear whitespace.
- else if (ch == '\r') {
+ } else if (ch == '\r') {
+ // line breaks are ignored, except for naked '\n'
+ // characters, which are consider parts of linear
+ // whitespace.
// see if this is a CRLF sequence, and skip the second if it
// is.
if (i < end - 1 && header.charAt(i + 1) == '\n') {
@@ -482,9 +481,8 @@ public final class MimeHelper {
} else if (ch == '\\') {
pos++;
requiresEscaping = true;
- }
- // we need to process line breaks also
- else if (ch == '\r') {
+ } else if (ch == '\r') {
+ // we need to process line breaks also
requiresEscaping = true;
}
}
@@ -524,9 +522,8 @@ public final class MimeHelper {
} else if (ch == '\\') {
pos++;
requiresEscaping = true;
- }
- // we need to process line breaks also
- else if (ch == '\r') {
+ } else if (ch == '\r') {
+ // we need to process line breaks also
requiresEscaping = true;
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/JSONParser.java Wed Aug 21 18:36:15 2013
@@ -38,7 +38,8 @@ import org.apache.chemistry.opencmis.com
*/
public class JSONParser {
public static final int S_INIT = 0;
- public static final int S_IN_FINISHED_VALUE = 1;// string,number,boolean,null,object,array
+ public static final int S_IN_FINISHED_VALUE = 1; // string, number, boolean,
+ // null, object, array
public static final int S_IN_OBJECT = 2;
public static final int S_IN_ARRAY = 3;
public static final int S_PASSED_PAIR_KEY = 4;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ServerVersion.java Wed Aug 21 18:36:15 2013
@@ -18,7 +18,7 @@
*/
package org.apache.chemistry.opencmis.server.impl;
-public class ServerVersion {
+public final class ServerVersion {
public static final String OPENCMIS_VERSION;
public static final String OPENCMIS_SERVER;
@@ -33,4 +33,7 @@ public class ServerVersion {
OPENCMIS_SERVER = "Apache-Chemistry-OpenCMIS/" + (OPENCMIS_VERSION == null ? "?" : OPENCMIS_VERSION);
}
}
+
+ private ServerVersion() {
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/CappedInputStream.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/CappedInputStream.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/CappedInputStream.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/CappedInputStream.java Wed Aug 21 18:36:15 2013
@@ -42,7 +42,7 @@ public class CappedInputStream extends I
}
/**
- * Returns the counter;
+ * Returns the counter.
*/
public long getCounter() {
return counter;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java Wed Aug 21 18:36:15 2013
@@ -24,7 +24,10 @@ import javax.servlet.http.HttpServletReq
import org.apache.chemistry.opencmis.commons.impl.IOUtils;
-public class HttpUtils {
+public final class HttpUtils {
+
+ private HttpUtils() {
+ }
/**
* Extracts a string parameter.
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrBinary.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrBinary.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrBinary.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrBinary.java Wed Aug 21 18:36:15 2013
@@ -33,9 +33,9 @@ import javax.jcr.Binary;
import javax.jcr.RepositoryException;
/**
- * <code>JcrBinary</code> implements the JCR <code>Binary</code> interface.
- * This is mostly a copy from org.apache.jackrabbit.value.BinaryImpl in
- * Apache Jackrabbit's jcr-commons module.
+ * <code>JcrBinary</code> implements the JCR <code>Binary</code> interface. This
+ * is mostly a copy from org.apache.jackrabbit.value.BinaryImpl in Apache
+ * Jackrabbit's jcr-commons module.
*/
public class JcrBinary implements Binary {
@@ -62,14 +62,17 @@ public class JcrBinary implements Binary
public static final Binary EMPTY = new JcrBinary(EMPTY_BYTE_ARRAY);
/**
- * Creates a new <code>JcrBinary</code> instance from an <code>InputStream</code>.
- * The contents of the stream is spooled to a temporary file or to a byte buffer
- * if its size is smaller than {@link #MAX_BUFFER_SIZE}.
- * The input stream is closed by this implementation.
- *
- * @param in stream to be represented as a <code>JcrBinary</code> instance
- * @throws IOException if an error occurs while reading from the stream or
- * writing to the temporary file
+ * Creates a new <code>JcrBinary</code> instance from an
+ * <code>InputStream</code>. The contents of the stream is spooled to a
+ * temporary file or to a byte buffer if its size is smaller than
+ * {@link #MAX_BUFFER_SIZE}. The input stream is closed by this
+ * implementation.
+ *
+ * @param in
+ * stream to be represented as a <code>JcrBinary</code> instance
+ * @throws IOException
+ * if an error occurs while reading from the stream or writing
+ * to the temporary file
*/
public JcrBinary(InputStream in) throws IOException {
byte[] spoolBuffer = new byte[0x2000];
@@ -83,8 +86,7 @@ public class JcrBinary implements Binary
// spool to temp file
out.write(spoolBuffer, 0, read);
len += read;
- }
- else if (len + read > MAX_BUFFER_SIZE) {
+ } else if (len + read > MAX_BUFFER_SIZE) {
// threshold for keeping data in memory exceeded;
// create temp file and spool buffer contents
@@ -94,8 +96,7 @@ public class JcrBinary implements Binary
out.write(spoolBuffer, 0, read);
buffer = null;
len += read;
- }
- else {
+ } else {
// reallocate new buffer and spool old buffer contents
byte[] newBuffer = new byte[len + read];
System.arraycopy(buffer, 0, newBuffer, 0, len);
@@ -104,8 +105,7 @@ public class JcrBinary implements Binary
len += read;
}
}
- }
- finally {
+ } finally {
in.close();
if (out != null) {
out.close();
@@ -117,9 +117,12 @@ public class JcrBinary implements Binary
}
/**
- * Creates a new <code>JcrBinary</code> instance from a <code>byte[]</code> array.
+ * Creates a new <code>JcrBinary</code> instance from a <code>byte[]</code>
+ * array.
*
- * @param buffer byte array to be represented as a <code>JcrBinary</code> instance
+ * @param buffer
+ * byte array to be represented as a <code>JcrBinary</code>
+ * instance
*/
public JcrBinary(byte[] buffer) {
if (buffer == null) {
@@ -134,12 +137,10 @@ public class JcrBinary implements Binary
try {
// this instance is backed by a temp file
return new FileInputStream(tmpFile);
- }
- catch (FileNotFoundException e) {
+ } catch (FileNotFoundException e) {
throw new RepositoryException("already disposed");
}
- }
- else {
+ } else {
// this instance is backed by an in-memory buffer
return new ByteArrayInputStream(buffer);
}
@@ -152,19 +153,16 @@ public class JcrBinary implements Binary
try {
raf.seek(position);
return raf.read(b);
- }
- finally {
+ } finally {
raf.close();
}
- }
- else {
+ } else {
// this instance is backed by an in-memory buffer
int length = Math.min(b.length, buffer.length - (int) position);
if (length > 0) {
System.arraycopy(buffer, (int) position, b, 0, length);
return length;
- }
- else {
+ } else {
return -1;
}
}
@@ -174,8 +172,7 @@ public class JcrBinary implements Binary
if (tmpFile != null) {
// this instance is backed by a temp file
return tmpFile.exists() ? tmpFile.length() : -1;
- }
- else {
+ } else {
// this instance is backed by an in-memory buffer
return buffer.length;
}
@@ -185,8 +182,7 @@ public class JcrBinary implements Binary
if (tmpFile != null) {
// this instance is backed by a temp file
tmpFile.delete();
- }
- else {
+ } else {
// this instance is backed by an in-memory buffer
buffer = EMPTY_BYTE_ARRAY;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrConverter.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrConverter.java Wed Aug 21 18:36:15 2013
@@ -61,24 +61,26 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Utility class providing methods for converting various entities from/to their respective representation
- * in JCR/CMIS.
+ * Utility class providing methods for converting various entities from/to their
+ * respective representation in JCR/CMIS.
*/
public final class JcrConverter {
private static final Logger log = LoggerFactory.getLogger(JcrConverter.class);
private static final Pattern QUALIFIED_NAME = Pattern.compile("\\{([^}]*)\\}(.*)");
private static final Pattern PREFIXED_NAME = Pattern.compile("(([^:/]+):)?([^:]*)");
-
- private JcrConverter() {}
+
+ private JcrConverter() {
+ }
/**
- * Escapes all illegal for JCR local name characters of a string.
- * The encoding is loosely modeled after URI encoding, but only encodes
- * the characters it absolutely needs to in order to make the resulting
- * string a valid JCR name.
+ * Escapes all illegal for JCR local name characters of a string. The
+ * encoding is loosely modeled after URI encoding, but only encodes the
+ * characters it absolutely needs to in order to make the resulting string a
+ * valid JCR name.
* <p/>
* QName EBNF:<br>
+ *
* <pre>
* simplename ::= onecharsimplename | twocharsimplename | threeormorecharname
* onecharsimplename ::= (* Any Unicode character except: '.', '/', ':', '[', ']', '*', '|' or any whitespace character *)
@@ -88,23 +90,22 @@ public final class JcrConverter {
* char ::= nonspace | ' '
* nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', '|' or any whitespace character *)
* </pre>
- *
- * @param cmisName the name to escape
+ *
+ * @param cmisName
+ * the name to escape
* @return the escaped name
*/
- private static String escapeForJcr(String cmisName){
+ private static String escapeForJcr(String cmisName) {
StringBuilder buffer = new StringBuilder(cmisName.length() * 16 + 32);
for (int i = 0; i < cmisName.length(); i++) {
char ch = cmisName.charAt(i);
- if (ch == '%' || ch == '/' || ch == ':' || ch == '[' || ch == ']' || ch == '*' || ch == '|'
- || ch == '\t' || ch == '\r' || ch == '\n'
- || ch == '.' && cmisName.length() < 3
- || ch == ' ' && (i == 0 || i == cmisName.length() - 1)) {
+ if (ch == '%' || ch == '/' || ch == ':' || ch == '[' || ch == ']' || ch == '*' || ch == '|' || ch == '\t'
+ || ch == '\r' || ch == '\n' || ch == '.' && cmisName.length() < 3 || ch == ' '
+ && (i == 0 || i == cmisName.length() - 1)) {
buffer.append('%');
buffer.append(Character.toUpperCase(Character.forDigit(ch / 16, 16)));
buffer.append(Character.toUpperCase(Character.forDigit(ch % 16, 16)));
- }
- else {
+ } else {
buffer.append(ch);
}
}
@@ -112,14 +113,15 @@ public final class JcrConverter {
}
/**
- * See JSR-283, 3.2 Names
- * A JCR name is an ordered pair of strings:
- * (N, L) where N is a JCR namespace and L is a JCR local name.
- * @param cmisName the name to escape
+ * See JSR-283, 3.2 Names A JCR name is an ordered pair of strings: (N, L)
+ * where N is a JCR namespace and L is a JCR local name.
+ *
+ * @param cmisName
+ * the name to escape
* @return the escaped name
- */
+ */
public static String toJcrName(String cmisName) {
- if (cmisName == null || cmisName.length()==0){
+ if (cmisName == null || cmisName.length() == 0) {
return null;
}
if (cmisName.charAt(0) == '{') {
@@ -129,15 +131,15 @@ public final class JcrConverter {
String localName = matcher.group(2);
StringBuilder builder = new StringBuilder(cmisName.length() * 16 + 32);
if (namespaceUri != null && namespaceUri.length() > 0) {
- //This must be valid URI
+ // This must be valid URI
try {
namespaceUri = new URI(namespaceUri).toString();
builder.append('{');
builder.append(namespaceUri);
builder.append('}');
} catch (URISyntaxException e1) {
- //Skip URI
- log.debug(e1.getMessage(),e1);
+ // Skip URI
+ log.debug(e1.getMessage(), e1);
}
}
builder.append(escapeForJcr(localName));
@@ -164,76 +166,78 @@ public final class JcrConverter {
* Convert a JCR <code>Property</code> to a CMIS <code>PropertyData</code>.
*
* @param jcrProperty
- * @return
+ * @return
* @throws RepositoryException
*/
public static PropertyData<?> convert(Property jcrProperty) throws RepositoryException {
AbstractPropertyData<?> propertyData;
switch (jcrProperty.getType()) {
- case PropertyType.BINARY:
- case PropertyType.NAME:
- case PropertyType.PATH:
- case PropertyType.REFERENCE:
- case PropertyType.WEAKREFERENCE:
- case PropertyType.STRING:
- propertyData = jcrProperty.isMultiple()
- ? new PropertyStringImpl(jcrProperty.getName(), toStrings(jcrProperty.getValues()))
- : new PropertyStringImpl(jcrProperty.getName(), jcrProperty.getString());
- break;
-
- case PropertyType.LONG:
- propertyData = jcrProperty.isMultiple()
- ? new PropertyIntegerImpl(jcrProperty.getName(), toInts(jcrProperty.getValues()))
- : new PropertyIntegerImpl(jcrProperty.getName(), BigInteger.valueOf(jcrProperty.getLong()));
- break;
-
- case PropertyType.DECIMAL:
- propertyData = jcrProperty.isMultiple()
- ? new PropertyDecimalImpl(jcrProperty.getName(), toDecs(jcrProperty.getValues()))
- : new PropertyDecimalImpl(jcrProperty.getName(), jcrProperty.getDecimal());
- break;
-
- case PropertyType.DOUBLE:
- propertyData = jcrProperty.isMultiple()
- ? new PropertyDecimalImpl(jcrProperty.getName(), doublesToDecs(jcrProperty.getValues()))
- : new PropertyDecimalImpl(jcrProperty.getName(), BigDecimal.valueOf(jcrProperty.getDouble()));
- break;
-
- case PropertyType.DATE:
- propertyData = jcrProperty.isMultiple()
- ? new PropertyDateTimeImpl(jcrProperty.getName(), toDates(jcrProperty.getValues()))
- : new PropertyDateTimeImpl(jcrProperty.getName(), Util.toCalendar(jcrProperty.getDate()));
- break;
-
- case PropertyType.BOOLEAN:
- propertyData = jcrProperty.isMultiple()
- ? new PropertyBooleanImpl(jcrProperty.getName(), toBools(jcrProperty.getValues()))
- : new PropertyBooleanImpl(jcrProperty.getName(), jcrProperty.getBoolean());
- break;
-
- case PropertyType.URI:
- propertyData = jcrProperty.isMultiple()
- ? new PropertyUriImpl(jcrProperty.getName(), toStrings(jcrProperty.getValues()))
- : new PropertyUriImpl(jcrProperty.getName(), jcrProperty.getString());
- break;
+ case PropertyType.BINARY:
+ case PropertyType.NAME:
+ case PropertyType.PATH:
+ case PropertyType.REFERENCE:
+ case PropertyType.WEAKREFERENCE:
+ case PropertyType.STRING:
+ propertyData = jcrProperty.isMultiple() ? new PropertyStringImpl(jcrProperty.getName(),
+ toStrings(jcrProperty.getValues())) : new PropertyStringImpl(jcrProperty.getName(),
+ jcrProperty.getString());
+ break;
+
+ case PropertyType.LONG:
+ propertyData = jcrProperty.isMultiple() ? new PropertyIntegerImpl(jcrProperty.getName(),
+ toInts(jcrProperty.getValues())) : new PropertyIntegerImpl(jcrProperty.getName(),
+ BigInteger.valueOf(jcrProperty.getLong()));
+ break;
+
+ case PropertyType.DECIMAL:
+ propertyData = jcrProperty.isMultiple() ? new PropertyDecimalImpl(jcrProperty.getName(),
+ toDecs(jcrProperty.getValues())) : new PropertyDecimalImpl(jcrProperty.getName(),
+ jcrProperty.getDecimal());
+ break;
+
+ case PropertyType.DOUBLE:
+ propertyData = jcrProperty.isMultiple() ? new PropertyDecimalImpl(jcrProperty.getName(),
+ doublesToDecs(jcrProperty.getValues())) : new PropertyDecimalImpl(jcrProperty.getName(),
+ BigDecimal.valueOf(jcrProperty.getDouble()));
+ break;
+
+ case PropertyType.DATE:
+ propertyData = jcrProperty.isMultiple() ? new PropertyDateTimeImpl(jcrProperty.getName(),
+ toDates(jcrProperty.getValues())) : new PropertyDateTimeImpl(jcrProperty.getName(),
+ Util.toCalendar(jcrProperty.getDate()));
+ break;
+
+ case PropertyType.BOOLEAN:
+ propertyData = jcrProperty.isMultiple() ? new PropertyBooleanImpl(jcrProperty.getName(),
+ toBools(jcrProperty.getValues())) : new PropertyBooleanImpl(jcrProperty.getName(),
+ jcrProperty.getBoolean());
+ break;
+
+ case PropertyType.URI:
+ propertyData = jcrProperty.isMultiple() ? new PropertyUriImpl(jcrProperty.getName(),
+ toStrings(jcrProperty.getValues())) : new PropertyUriImpl(jcrProperty.getName(),
+ jcrProperty.getString());
+ break;
- default:
- throw new CmisInvalidArgumentException("Invalid property type: " + jcrProperty.getType());
+ default:
+ throw new CmisInvalidArgumentException("Invalid property type: " + jcrProperty.getType());
}
propertyData.setDisplayName(jcrProperty.getName());
propertyData.setLocalName(jcrProperty.getName());
propertyData.setQueryName(jcrProperty.getName());
-
+
return propertyData;
}
/**
- * Set a property on a JCR node.
- *
- * @param node the node to set the property
- * @param propertyData the property to set
+ * Set a property on a JCR node.
+ *
+ * @param node
+ * the node to set the property
+ * @param propertyData
+ * the property to set
* @throws RepositoryException
*/
public static void setProperty(Node node, PropertyData<?> propertyData) throws RepositoryException {
@@ -243,36 +247,28 @@ public final class JcrConverter {
if (propertyData instanceof PropertyBoolean) {
values = toValue((PropertyBoolean) propertyData, node.getSession().getValueFactory());
propertyType = PropertyType.BOOLEAN;
- }
- else if (propertyData instanceof PropertyDateTime) {
+ } else if (propertyData instanceof PropertyDateTime) {
values = toValue((PropertyDateTime) propertyData, node.getSession().getValueFactory());
propertyType = PropertyType.DATE;
- }
- else if (propertyData instanceof PropertyDecimal) {
+ } else if (propertyData instanceof PropertyDecimal) {
values = toValue((PropertyDecimal) propertyData, node.getSession().getValueFactory());
propertyType = PropertyType.DECIMAL;
- }
- else if (propertyData instanceof PropertyHtml) {
+ } else if (propertyData instanceof PropertyHtml) {
values = toValue((PropertyHtml) propertyData, node.getSession().getValueFactory());
propertyType = PropertyType.STRING;
- }
- else if (propertyData instanceof PropertyId) {
+ } else if (propertyData instanceof PropertyId) {
values = toValue((PropertyId) propertyData, node.getSession().getValueFactory());
propertyType = PropertyType.STRING;
- }
- else if (propertyData instanceof PropertyInteger) {
+ } else if (propertyData instanceof PropertyInteger) {
values = toValue((PropertyInteger) propertyData, node.getSession().getValueFactory());
propertyType = PropertyType.DECIMAL;
- }
- else if (propertyData instanceof PropertyString) {
+ } else if (propertyData instanceof PropertyString) {
values = toValue((PropertyString) propertyData, node.getSession().getValueFactory());
propertyType = PropertyType.STRING;
- }
- else if (propertyData instanceof PropertyUri) {
+ } else if (propertyData instanceof PropertyUri) {
values = toValue((PropertyUri) propertyData, node.getSession().getValueFactory());
propertyType = PropertyType.URI;
- }
- else {
+ } else {
throw new CmisInvalidArgumentException("Invalid property type: " + propertyData);
}
@@ -281,44 +277,42 @@ public final class JcrConverter {
if (PropertyIds.NAME.equals(id)) {
node.addMixin(NodeType.MIX_TITLE);
name = Property.JCR_TITLE;
- }
- else if (PropertyIds.CONTENT_STREAM_MIME_TYPE.equals(id)) {
+ } else if (PropertyIds.CONTENT_STREAM_MIME_TYPE.equals(id)) {
name = Property.JCR_MIMETYPE;
- }
- else {
+ } else {
name = toJcrName(propertyData.getId());
}
if (values.length == 1) {
node.setProperty(name, values[0]);
- }
- else {
+ } else {
node.setProperty(name, values, propertyType);
}
}
/**
* Remove a property from a JCR node
- *
- * @param node the node from which to remove the property
- * @param propertyData the property to remove
+ *
+ * @param node
+ * the node from which to remove the property
+ * @param propertyData
+ * the property to remove
* @throws RepositoryException
*/
public static void removeProperty(Node node, PropertyData<?> propertyData) throws RepositoryException {
String id = propertyData.getId();
- String name = PropertyIds.NAME.equals(id)
- ? Property.JCR_TITLE :
- toJcrName(propertyData.getId());
+ String name = PropertyIds.NAME.equals(id) ? Property.JCR_TITLE : toJcrName(propertyData.getId());
if (node.hasProperty(name)) {
node.getProperty(name).remove();
}
}
- //------------------------------------------< private >---
+ // ------------------------------------------< private >---
/**
- * Convert an array of <code>Value</code>s to a list of <code>String</code>s.
+ * Convert an array of <code>Value</code>s to a list of <code>String</code>
+ * s.
*/
private static List<String> toStrings(Value[] values) throws RepositoryException {
ArrayList<String> strings = new ArrayList<String>(values.length);
@@ -331,7 +325,8 @@ public final class JcrConverter {
}
/**
- * Convert an array of <code>Value</code>s to a list of <code>BigInteger</code>s.
+ * Convert an array of <code>Value</code>s to a list of
+ * <code>BigInteger</code>s.
*/
private static List<BigInteger> toInts(Value[] values) throws RepositoryException {
ArrayList<BigInteger> ints = new ArrayList<BigInteger>(values.length);
@@ -344,7 +339,8 @@ public final class JcrConverter {
}
/**
- * Convert an array of <code>Value</code>s to a list of <code>BigDecimal</code>s.
+ * Convert an array of <code>Value</code>s to a list of
+ * <code>BigDecimal</code>s.
*/
private static List<BigDecimal> toDecs(Value[] values) throws RepositoryException {
ArrayList<BigDecimal> decs = new ArrayList<BigDecimal>(values.length);
@@ -357,7 +353,8 @@ public final class JcrConverter {
}
/**
- * Convert an array of double <code>Value</code>s to a list of <code>BigInteger</code>s.
+ * Convert an array of double <code>Value</code>s to a list of
+ * <code>BigInteger</code>s.
*/
private static List<BigDecimal> doublesToDecs(Value[] values) throws RepositoryException {
ArrayList<BigDecimal> decs = new ArrayList<BigDecimal>(values.length);
@@ -370,7 +367,8 @@ public final class JcrConverter {
}
/**
- * Convert an array of <code>Value</code>s to a list of <code>Booleans</code>s.
+ * Convert an array of <code>Value</code>s to a list of
+ * <code>Booleans</code>s.
*/
private static List<Boolean> toBools(Value[] values) throws RepositoryException {
ArrayList<Boolean> bools = new ArrayList<Boolean>(values.length);
@@ -383,7 +381,8 @@ public final class JcrConverter {
}
/**
- * Convert an array of <code>Value</code>s to a list of <code>GregorianCalendar</code>s.
+ * Convert an array of <code>Value</code>s to a list of
+ * <code>GregorianCalendar</code>s.
*/
private static List<GregorianCalendar> toDates(Value[] values) throws RepositoryException {
ArrayList<GregorianCalendar> dates = new ArrayList<GregorianCalendar>(values.length);
@@ -396,7 +395,8 @@ public final class JcrConverter {
}
/**
- * Convert a <code>PropertyBoolean</code> to an array of JCR <code>Values</code>.
+ * Convert a <code>PropertyBoolean</code> to an array of JCR
+ * <code>Values</code>.
*/
private static Value[] toValue(PropertyBoolean propertyData, ValueFactory valueFactory) {
List<Boolean> values = propertyData.getValues();
@@ -414,7 +414,8 @@ public final class JcrConverter {
}
/**
- * Convert a <code>PropertyDateTime</code> to an array of JCR <code>Values</code>.
+ * Convert a <code>PropertyDateTime</code> to an array of JCR
+ * <code>Values</code>.
*/
private static Value[] toValue(PropertyDateTime propertyData, ValueFactory valueFactory) {
List<GregorianCalendar> values = propertyData.getValues();
@@ -432,7 +433,8 @@ public final class JcrConverter {
}
/**
- * Convert a <code>PropertyDecimal</code> to an array of JCR <code>Values</code>.
+ * Convert a <code>PropertyDecimal</code> to an array of JCR
+ * <code>Values</code>.
*/
private static Value[] toValue(PropertyDecimal propertyData, ValueFactory valueFactory) {
List<BigDecimal> values = propertyData.getValues();
@@ -450,7 +452,8 @@ public final class JcrConverter {
}
/**
- * Convert a <code>PropertyHtml</code> to an array of JCR <code>Values</code>.
+ * Convert a <code>PropertyHtml</code> to an array of JCR
+ * <code>Values</code>.
*/
private static Value[] toValue(PropertyHtml propertyData, ValueFactory valueFactory) {
List<String> values = propertyData.getValues();
@@ -486,7 +489,8 @@ public final class JcrConverter {
}
/**
- * Convert a <code>PropertyInteger</code> to an array of JCR <code>Values</code>.
+ * Convert a <code>PropertyInteger</code> to an array of JCR
+ * <code>Values</code>.
*/
private static Value[] toValue(PropertyInteger propertyData, ValueFactory valueFactory) {
List<BigInteger> values = propertyData.getValues();
@@ -504,7 +508,8 @@ public final class JcrConverter {
}
/**
- * Convert a <code>PropertyString</code> to an array of JCR <code>Values</code>.
+ * Convert a <code>PropertyString</code> to an array of JCR
+ * <code>Values</code>.
*/
private static Value[] toValue(PropertyString propertyData, ValueFactory valueFactory) {
List<String> values = propertyData.getValues();
@@ -522,7 +527,8 @@ public final class JcrConverter {
}
/**
- * Convert a <code>PropertyUri</code> to an array of JCR <code>Values</code>.
+ * Convert a <code>PropertyUri</code> to an array of JCR <code>Values</code>
+ * .
*/
private static Value[] toValue(PropertyUri propertyData, ValueFactory valueFactory) throws ValueFormatException {
List<String> values = propertyData.getValues();
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrDocument.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrDocument.java?rev=1516250&r1=1516249&r2=1516250&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrDocument.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrDocument.java Wed Aug 21 18:36:15 2013
@@ -46,33 +46,34 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Instances of this class represent a cmis:document backed by an underlying JCR <code>Node</code>.
+ * Instances of this class represent a cmis:document backed by an underlying JCR
+ * <code>Node</code>.
*/
public abstract class JcrDocument extends JcrNode {
- private static final Logger log = LoggerFactory.getLogger(JcrDocument.class);
+ private static final Logger LOG = LoggerFactory.getLogger(JcrDocument.class);
public static final String MIME_UNKNOWN = "application/octet-stream";
- protected JcrDocument(Node node, JcrTypeManager typeManager, PathManager pathManager, JcrTypeHandlerManager typeHandlerManager) {
+ protected JcrDocument(Node node, JcrTypeManager typeManager, PathManager pathManager,
+ JcrTypeHandlerManager typeHandlerManager) {
super(node, typeManager, pathManager, typeHandlerManager);
}
/**
- * @return <code>true</code> iff the document is checked out
+ * @return <code>true</code> iff the document is checked out
*/
public boolean isDocumentCheckedOut() {
try {
return getNode().isCheckedOut();
- }
- catch (RepositoryException e) {
- log.debug(e.getMessage(), e);
+ } catch (RepositoryException e) {
+ LOG.debug(e.getMessage(), e);
throw new CmisRuntimeException(e.getMessage(), e);
}
}
/**
* See CMIS 1.0 section 2.2.4.10 getContentStream
- *
+ *
* @throws CmisObjectNotFoundException
* @throws CmisRuntimeException
*/
@@ -86,28 +87,30 @@ public abstract class JcrDocument extend
result.setFileName(getNodeName());
result.setLength(BigInteger.valueOf(data.getLength()));
result.setMimeType(getPropertyOrElse(contentNode, Property.JCR_MIMETYPE, MIME_UNKNOWN));
- result.setStream(new BufferedInputStream(data.getBinary().getStream())); // stream closed by consumer
+ result.setStream(new BufferedInputStream(data.getBinary().getStream())); // stream
+ // closed
+ // by
+ // consumer
return result;
- }
- catch (PathNotFoundException e) {
- log.debug(e.getMessage(), e);
+ } catch (PathNotFoundException e) {
+ LOG.debug(e.getMessage(), e);
throw new CmisObjectNotFoundException(e.getMessage(), e);
- }
- catch (RepositoryException e) {
- log.debug(e.getMessage(), e);
+ } catch (RepositoryException e) {
+ LOG.debug(e.getMessage(), e);
throw new CmisRuntimeException(e.getMessage(), e);
}
}
/**
* See CMIS 1.0 section 2.2.4.16 setContentStream
- *
+ *
* @throws CmisStorageException
*/
public JcrNode setContentStream(ContentStream contentStream, boolean overwriteFlag) {
try {
- // get content node. For version series this is *not* the same as the
+ // get content node. For version series this is *not* the same as
+ // the
// context node. See CMIS-438.
Node contentNode = getNode().getNode(Node.JCR_CONTENT);
Property data = contentNode.getProperty(Property.JCR_DATA);
@@ -117,9 +120,7 @@ public abstract class JcrDocument extend
throw new CmisContentAlreadyExistsException("Content already exists!");
}
- JcrVersionBase jcrVersion = isVersionable()
- ? asVersion()
- : null;
+ JcrVersionBase jcrVersion = isVersionable() ? asVersion() : null;
boolean autoCheckout = jcrVersion != null && !jcrVersion.isCheckedOut();
if (autoCheckout) {
@@ -127,16 +128,14 @@ public abstract class JcrDocument extend
}
// write content, if available
- Binary binary = contentStream == null || contentStream.getStream() == null
- ? JcrBinary.EMPTY
+ Binary binary = contentStream == null || contentStream.getStream() == null ? JcrBinary.EMPTY
: new JcrBinary(new BufferedInputStream(contentStream.getStream()));
try {
contentNode.setProperty(Property.JCR_DATA, binary);
if (contentStream != null && contentStream.getMimeType() != null) {
contentNode.setProperty(Property.JCR_MIMETYPE, contentStream.getMimeType());
}
- }
- finally {
+ } finally {
binary.dispose();
}
@@ -145,74 +144,72 @@ public abstract class JcrDocument extend
if (autoCheckout) {
// auto versioning -> return new version created by checkin
return jcrVersion.checkin(null, null, "auto checkout");
- }
- else if (jcrVersion != null) {
+ } else if (jcrVersion != null) {
// the node is checked out -> return pwc.
return jcrVersion.getPwc();
- }
- else {
+ } else {
// non versionable -> return this
return this;
}
- }
- catch (RepositoryException e) {
- log.debug(e.getMessage(), e);
+ } catch (RepositoryException e) {
+ LOG.debug(e.getMessage(), e);
throw new CmisStorageException(e.getMessage(), e);
- }
- catch (IOException e) {
- log.debug(e.getMessage(), e);
+ } catch (IOException e) {
+ LOG.debug(e.getMessage(), e);
throw new CmisStorageException(e.getMessage(), e);
}
}
- //------------------------------------------< protected >---
+ // ------------------------------------------< protected >---
/**
- * @return the value of the <code>cmis:isLatestVersion</code> property
+ * @return the value of the <code>cmis:isLatestVersion</code> property
* @throws RepositoryException
*/
protected abstract boolean isLatestVersion() throws RepositoryException;
/**
- * @return the value of the <code>cmis:isMajorVersion</code> property
+ * @return the value of the <code>cmis:isMajorVersion</code> property
* @throws RepositoryException
*/
protected abstract boolean isMajorVersion() throws RepositoryException;
/**
- * @return the value of the <code>cmis:isLatestMajorVersion</code> property
+ * @return the value of the <code>cmis:isLatestMajorVersion</code> property
* @throws RepositoryException
*/
protected abstract boolean isLatestMajorVersion() throws RepositoryException;
/**
- * @return the value of the <code>cmis:versionLabel</code> property
+ * @return the value of the <code>cmis:versionLabel</code> property
* @throws RepositoryException
*/
protected abstract String getVersionLabel() throws RepositoryException;
/**
- * @return the value of the <code>cmis:isVersionSeriesCheckedOut</code> property
+ * @return the value of the <code>cmis:isVersionSeriesCheckedOut</code>
+ * property
* @throws RepositoryException
*/
protected abstract boolean isCheckedOut() throws RepositoryException;
/**
- * @return the value of the <code>cmis:versionSeriesCheckedOutId</code> property
+ * @return the value of the <code>cmis:versionSeriesCheckedOutId</code>
+ * property
* @throws RepositoryException
*/
protected abstract String getCheckedOutId() throws RepositoryException;
/**
- * @return the value of the <code>cmis:versionSeriesCheckedOutBy</code> property
+ * @return the value of the <code>cmis:versionSeriesCheckedOutBy</code>
+ * property
* @throws RepositoryException
*/
protected abstract String getCheckedOutBy() throws RepositoryException;
-
/**
- * @return the value of the <code>cmis:checkinComment</code> property
+ * @return the value of the <code>cmis:checkinComment</code> property
* @throws RepositoryException
*/
protected abstract String getCheckInComment() throws RepositoryException;