You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2013/08/15 16:31:21 UTC
svn commit: r1514297 [2/2] - in /chemistry/opencmis/trunk:
chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/
chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org...
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java Thu Aug 15 14:31:20 2013
@@ -40,8 +40,8 @@ public class ContentStreamDataImpl imple
private static final Logger LOG = LoggerFactory.getLogger(ContentStreamDataImpl.class.getName());
- private static long TOTAL_LENGTH = 0L;
- private static long TOTAL_CALLS = 0L;
+ private static long totalLength = 0L;
+ private static long totalCalls = 0L;
private int fLength;
@@ -65,29 +65,32 @@ public class ContentStreamDataImpl imple
}
public void setContent(InputStream in) throws IOException {
- fStreamLimitOffset = fStreamLimitLength = -1;
+ fStreamLimitOffset = -1;
+ fStreamLimitLength = -1;
if (null == in) {
fContent = null; // delete content
fLength = 0;
} else {
byte[] buffer = new byte[0xFFFF];
ByteArrayOutputStream contentStream = new ByteArrayOutputStream();
- for (int len = 0; (len = in.read(buffer)) != -1;) {
+ int len = in.read(buffer);
+ while (len != -1) {
contentStream.write(buffer, 0, len);
fLength += len;
if (sizeLimitKB > 0 && fLength > sizeLimitKB * 1024) {
throw new CmisInvalidArgumentException("Content size exceeds max. allowed size of " + sizeLimitKB
+ "KB.");
}
+ len = in.read(buffer);
}
fContent = contentStream.toByteArray();
fLength = contentStream.size();
contentStream.close();
in.close();
}
- TOTAL_LENGTH += fLength;
- LOG.debug("setting content stream, total no calls " + ++TOTAL_CALLS + ".");
- LOG.debug("setting content stream, new size total " + (TOTAL_LENGTH / (1024 * 1024)) + "MB.");
+ totalLength += fLength;
+ LOG.debug("setting content stream, total no calls " + ++totalCalls + ".");
+ LOG.debug("setting content stream, new size total " + (totalLength / (1024 * 1024)) + "MB.");
}
public void appendContent(InputStream is) throws IOException {
@@ -100,25 +103,27 @@ public class ContentStreamDataImpl imple
// first read existing stream
contentStream.write(fContent);
- TOTAL_LENGTH -= fLength;
+ totalLength -= fLength;
// then append new content
- for (int len = 0; (len = is.read(buffer)) != -1;) {
+ int len = is.read(buffer);
+ while (len != -1) {
contentStream.write(buffer, 0, len);
fLength += len;
if (sizeLimitKB > 0 && fLength > sizeLimitKB * 1024) {
throw new CmisInvalidArgumentException("Content size exceeds max. allowed size of " + sizeLimitKB
+ "KB.");
}
+ len = is.read(buffer);
}
fContent = contentStream.toByteArray();
fLength = contentStream.size();
contentStream.close();
is.close();
}
- TOTAL_LENGTH += fLength;
- LOG.debug("setting content stream, total no calls " + ++TOTAL_CALLS + ".");
- LOG.debug("setting content stream, new size total " + (TOTAL_LENGTH / (1024 * 1024)) + "MB.");
+ totalLength += fLength;
+ LOG.debug("setting content stream, total no calls " + ++totalCalls + ".");
+ LOG.debug("setting content stream, new size total " + (totalLength / (1024 * 1024)) + "MB.");
}
@Override
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java Thu Aug 15 14:31:20 2013
@@ -51,7 +51,7 @@ public class DocumentImpl extends Filing
private ContentStreamDataImpl fContent;
private static final Logger LOG = LoggerFactory.getLogger(DocumentImpl.class.getName());
- private final Long MAX_CONTENT_SIZE_KB = ConfigurationSettings.getConfigurationValueAsLong(ConfigConstants.MAX_CONTENT_SIZE_KB);
+ private static final Long MAX_CONTENT_SIZE_KB = ConfigurationSettings.getConfigurationValueAsLong(ConfigConstants.MAX_CONTENT_SIZE_KB);
public static final int THUMBNAIL_SIZE = 100;
@@ -90,8 +90,7 @@ public class DocumentImpl extends Filing
try {
fContent.setContent(content.getStream());
} catch (IOException e) {
- e.printStackTrace();
- throw new RuntimeException("Failed to get content from InputStream", e);
+ throw new CmisRuntimeException("Failed to get content from InputStream", e);
}
}
}
@@ -106,7 +105,6 @@ public class DocumentImpl extends Filing
try {
fContent.appendContent(content.getStream());
} catch (IOException e) {
- e.printStackTrace();
throw new CmisStorageException("Failed to append content: IO Exception", e);
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java Thu Aug 15 14:31:20 2013
@@ -28,6 +28,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.data.ContentStream;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
import org.apache.chemistry.opencmis.inmemory.ConfigConstants;
@@ -45,21 +46,20 @@ import org.apache.chemistry.opencmis.inm
*/
public class DocumentVersionImpl extends StoredObjectImpl implements DocumentVersion, MultiFiling {
- private final Long MAX_CONTENT_SIZE_KB = ConfigurationSettings.getConfigurationValueAsLong(ConfigConstants.MAX_CONTENT_SIZE_KB);
+ private static final Long MAX_CONTENT_SIZE_KB = ConfigurationSettings.getConfigurationValueAsLong(ConfigConstants.MAX_CONTENT_SIZE_KB);
private ContentStreamDataImpl fContent;
- private final VersionedDocumentImpl fContainer; // the document this version belongs
- // to
+ private final VersionedDocumentImpl fContainer; // the document this version belongs to
private String fComment; // checkin comment
- boolean fIsMajor;
- boolean fIsPwc; // true if this is the PWC
+ private boolean fIsMajor;
+ private boolean fIsPwc; // true if this is the PWC
public DocumentVersionImpl(String repositoryId, VersionedDocument container, ContentStream content,
VersioningState verState) {
super();
setRepositoryId(repositoryId);
fContainer = (VersionedDocumentImpl) container;
- setContent(content, false);
+ setContentIntern(content, false);
fIsMajor = verState == VersioningState.MAJOR || verState == null;
fIsPwc = verState == VersioningState.CHECKEDOUT;
fProperties = new HashMap<String, PropertyData<?>>();
@@ -74,6 +74,10 @@ public class DocumentVersionImpl extends
@Override
public void setContent(ContentStream content, boolean mustPersist) {
+ setContentIntern(content, mustPersist);
+ }
+
+ private void setContentIntern(ContentStream content, boolean mustPersist) {
if (null == content) {
fContent = null;
} else {
@@ -84,8 +88,7 @@ public class DocumentVersionImpl extends
try {
fContent.setContent(content.getStream());
} catch (IOException e) {
- e.printStackTrace();
- throw new RuntimeException("Failed to get content from InputStream", e);
+ throw new CmisRuntimeException("Failed to get content from InputStream", e);
}
}
}
@@ -100,7 +103,6 @@ public class DocumentVersionImpl extends
try {
fContent.appendContent(content.getStream());
} catch (IOException e) {
- e.printStackTrace();
throw new CmisStorageException("Failed to append content: IO Exception", e);
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java Thu Aug 15 14:31:20 2013
@@ -39,13 +39,12 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.inmemory.FilterParser;
import org.apache.chemistry.opencmis.inmemory.NameValidator;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FolderImpl extends StoredObjectImpl implements Folder {
private static final Logger LOG = LoggerFactory.getLogger(FilingImpl.class.getName());
- protected String parentId;
+ private String parentId;
public FolderImpl() {
super();
@@ -76,10 +75,6 @@ public class FolderImpl extends StoredOb
PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS, allowedChildObjects));
}
-// if (FilterParser.isContainedInFilter(PropertyIds.PATH, requestedIds)) {
-// String path = getPath();
-// properties.put(PropertyIds.PATH, objFactory.createPropertyStringData(PropertyIds.PATH, path));
-// }
}
@Override
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ImageThumbnailGenerator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ImageThumbnailGenerator.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ImageThumbnailGenerator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ImageThumbnailGenerator.java Thu Aug 15 14:31:20 2013
@@ -87,8 +87,9 @@ public class ImageThumbnailGenerator {
return storeImageinByteArray(resizedImage);
}
- private BufferedImage scaleLongerSideTo(BufferedImage bi, int longerSideLength) throws IOException {
+ private BufferedImage scaleLongerSideTo(BufferedImage bi, int longerSideLengthParam) throws IOException {
int width, height;
+ int longerSideLength = longerSideLengthParam;
if (longerSideLength <= 0)
longerSideLength = 100;
@@ -108,7 +109,6 @@ public class ImageThumbnailGenerator {
private BufferedImage scaleImage(BufferedImage originalImage, int width, int height) {
BufferedImage resizedImage = new BufferedImage(width, height, originalImage.getType());
- // ColorSpace.TYPE_RGB);
Graphics2D g = resizedImage.createGraphics();
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java Thu Aug 15 14:31:20 2013
@@ -28,16 +28,18 @@ import org.apache.chemistry.opencmis.com
public class InMemoryAce {
+ private static final String ANONYMOUS = "anonymous";
+ private static final String ANYONE = "anyone";
private final String principalId;
private Permission permission;
- private static InMemoryAce DEFAULT_ACE = new InMemoryAce(InMemoryAce.getAnyoneUser(), Permission.ALL);
+ private static final InMemoryAce DEFAULT_ACE = new InMemoryAce(InMemoryAce.getAnyoneUser(), Permission.ALL);
public static final String getAnyoneUser() {
- return "anyone";
+ return ANYONE;
}
public static final String getAnonymousUser() {
- return "anonymous";
+ return ANONYMOUS;
}
public static final InMemoryAce getDefaultAce() {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java Thu Aug 15 14:31:20 2013
@@ -32,13 +32,13 @@ public class InMemoryAcl implements Clon
private List<InMemoryAce> acl;
private int id;
@SuppressWarnings("serial")
- private static InMemoryAcl DEFAULT_ACL = new InMemoryAcl(new ArrayList<InMemoryAce>() {{ add(InMemoryAce.getDefaultAce()); }} );
+ private static final InMemoryAcl DEFAULT_ACL = new InMemoryAcl(new ArrayList<InMemoryAce>() {{ add(InMemoryAce.getDefaultAce()); }} );
private static class AceComparator<T extends InMemoryAce> implements Comparator<T> {
@Override
public int compare(T o1, T o2) {
if (null == o1 || null == o2) {
- if (o1 == o2)
+ if (o1 == o2) //NOSONAR
return 0;
else if (o1 == null)
return 1;
@@ -51,7 +51,7 @@ public class InMemoryAcl implements Clon
};
- private static Comparator<? super InMemoryAce> COMP = new AceComparator<InMemoryAce>();
+ private static final Comparator<? super InMemoryAce> COMP = new AceComparator<InMemoryAce>();
public static InMemoryAcl createFromCommonsAcl(Acl commonsAcl) {
InMemoryAcl acl = new InMemoryAcl();
@@ -224,7 +224,7 @@ public class InMemoryAcl implements Clon
}
@Override
- public InMemoryAcl clone() {
+ public InMemoryAcl clone() throws CloneNotSupportedException {
InMemoryAcl newAcl = new InMemoryAcl(acl);
return newAcl;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java Thu Aug 15 14:31:20 2013
@@ -91,19 +91,6 @@ public class InMemoryServiceValidatorImp
*
* @see
* org.apache.chemistry.opencmis.inmemory.server.BaseServiceValidatorImpl
- * #checkRepositoryId(java.lang.String)
- */
- @Override
- protected void checkRepositoryId(String repositoryId) {
-
- super.checkRepositoryId(repositoryId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.chemistry.opencmis.inmemory.server.BaseServiceValidatorImpl
* #checkParams(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
@@ -677,8 +664,6 @@ public class InMemoryServiceValidatorImp
ExtensionsData extension) {
StoredObject so = super.cancelCheckOut(context, repositoryId, objectId, extension);
- // StoredObject container = so instanceof DocumentVersion ?
- // ((DocumentVersion)so).getParentDocument() : so;
checkWriteAccess(repositoryId, context.getUsername(), so);
return so;
}
@@ -697,8 +682,6 @@ public class InMemoryServiceValidatorImp
Acl removeAces, List<String> policyIds, ExtensionsData extension) {
StoredObject so = super.checkIn(context, repositoryId, objectId, addAces, removeAces, policyIds, extension);
- // StoredObject container = so instanceof DocumentVersion ?
- // ((DocumentVersion)so).getParentDocument() : so;
if (null != addAces || null != removeAces)
throw new CmisInvalidArgumentException(
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java Thu Aug 15 14:31:20 2013
@@ -40,6 +40,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisNameConstraintViolationException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.Document;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
@@ -97,7 +98,7 @@ public class ObjectStoreImpl implements
/**
* Simple id generator that uses just an integer
*/
- private static int NEXT_UNUSED_ID = 100;
+ private static int nextUnusedId = 100;
/**
* a concurrent HashMap as core element to hold all objects in the
@@ -115,7 +116,7 @@ public class ObjectStoreImpl implements
private final Lock fLock = new ReentrantLock();
final String fRepositoryId;
- FolderImpl fRootFolder = null;
+ private FolderImpl fRootFolder = null;
public ObjectStoreImpl(String repositoryId) {
fRepositoryId = repositoryId;
@@ -123,7 +124,7 @@ public class ObjectStoreImpl implements
}
private static synchronized Integer getNextId() {
- return NEXT_UNUSED_ID++;
+ return nextUnusedId++;
}
private synchronized Integer getNextAclId() {
@@ -179,7 +180,7 @@ public class ObjectStoreImpl implements
StoredObject obj = fStoredObjectMap.get(objectId);
if (null == obj) {
- throw new RuntimeException("Cannot delete object with id " + objectId + ". Object does not exist.");
+ throw new CmisObjectNotFoundException("Cannot delete object with id " + objectId + ". Object does not exist.");
}
if (obj instanceof FolderImpl) {
@@ -596,17 +597,13 @@ public class ObjectStoreImpl implements
}
@Override
- public ChildrenResult getChildren(Folder folder, int maxItems, int skipCount, String user, boolean usePwc) {
+ public ChildrenResult getChildren(Folder folder, int maxItemsParam, int skipCountParam, String user, boolean usePwc) {
List<Fileable> children = getChildren(folder, user, usePwc);
sortFolderList(children);
- if (maxItems < 0) {
- maxItems = children.size();
- }
- if (skipCount < 0) {
- skipCount = 0;
- }
-
+ int maxItems = maxItemsParam < 0 ? children.size() : maxItemsParam;
+ int skipCount = skipCountParam < 0 ? 0 : skipCountParam;
+
int from = Math.min(skipCount, children.size());
int to = Math.min(maxItems + from, children.size());
int noItems = children.size();
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerFactory.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerFactory.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerFactory.java Thu Aug 15 14:31:20 2013
@@ -18,6 +18,7 @@
*/
package org.apache.chemistry.opencmis.inmemory.storedobj.impl;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -27,9 +28,9 @@ import org.slf4j.LoggerFactory;
*
* @author Jens
*/
-public class StoreManagerFactory {
+public final class StoreManagerFactory {
- private static final Logger log = LoggerFactory.getLogger(StoreManagerFactory.class);
+ private static final Logger LOG = LoggerFactory.getLogger(StoreManagerFactory.class);
private StoreManagerFactory() {
}
@@ -41,26 +42,23 @@ public class StoreManagerFactory {
clazz = Class.forName(className);
} catch (ClassNotFoundException e) {
String msg = "Failed to create StoredObjectCreator, class " + className + " does not exist.";
- log.error(msg, e);
- e.printStackTrace();
- throw new RuntimeException(msg, e);
+ LOG.error(msg, e);
+ throw new CmisRuntimeException(msg, e);
}
Object obj = null;
try {
obj = clazz.newInstance();
} catch (InstantiationException e) {
- log.error("Failed to create StoredObjectCreator from class " + className, e);
- e.printStackTrace();
+ LOG.error("Failed to create StoredObjectCreator from class " + className, e);
} catch (IllegalAccessException e) {
- log.error("Failed to create StoredObjectCreator from class " + className, e);
- e.printStackTrace();
+ LOG.error("Failed to create StoredObjectCreator from class " + className, e);
}
if (obj instanceof StoreManager) {
return (StoreManager) obj;
} else {
- log.error("Failed to create StoredObjectCreator, class " + className
+ LOG.error("Failed to create StoredObjectCreator, class " + className
+ " does not implement interface StoredObjectCreator");
return null;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java Thu Aug 15 14:31:20 2013
@@ -50,6 +50,8 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.PropertyType;
import org.apache.chemistry.opencmis.commons.enums.SupportedPermissions;
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AclCapabilitiesDataImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
@@ -61,7 +63,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionContainerImpl;
import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
-import org.apache.chemistry.opencmis.inmemory.RepositoryInfoCreator;
import org.apache.chemistry.opencmis.inmemory.TypeCreator;
import org.apache.chemistry.opencmis.inmemory.TypeManagerImpl;
import org.apache.chemistry.opencmis.inmemory.query.InMemoryQueryProcessor;
@@ -79,13 +80,12 @@ import org.apache.chemistry.opencmis.ser
*/
public class StoreManagerImpl implements StoreManager {
+ private static final String UNKNOWN_REPOSITORY = "Unknown repository ";
private static final String CMIS_READ = "cmis:read";
private static final String CMIS_WRITE = "cmis:write";
private static final String CMIS_ALL = "cmis:all";
- protected final BindingsObjectFactory fObjectFactory;
- protected RepositoryInfo fRepositoryInfo;
- protected CmisServiceValidator validator;
+ private final BindingsObjectFactory fObjectFactory;
private static final String OPENCMIS_VERSION;
private static final String OPENCMIS_SERVER;
@@ -138,7 +138,7 @@ public class StoreManagerImpl implements
public void createAndInitRepository(String repositoryId, String typeCreatorClassName) {
if (fMapRepositoryToObjectStore.containsKey(repositoryId)
|| fMapRepositoryToTypeManager.containsKey(repositoryId)) {
- throw new RuntimeException("Cannot add repository, repository " + repositoryId + " already exists.");
+ throw new CmisInvalidArgumentException("Cannot add repository, repository " + repositoryId + " already exists.");
}
fMapRepositoryToObjectStore.put(repositoryId, new ObjectStoreImpl(repositoryId));
@@ -167,7 +167,7 @@ public class StoreManagerImpl implements
public TypeDefinitionContainer getTypeById(String repositoryId, String typeId) {
TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
if (null == typeManager) {
- throw new RuntimeException("Unknown repository " + repositoryId);
+ throw new CmisObjectNotFoundException(UNKNOWN_REPOSITORY + repositoryId);
}
boolean cmis11 = InMemoryServiceContext.getCallContext().getCmisVersion() != CmisVersion.CMIS_1_0;
@@ -185,10 +185,11 @@ public class StoreManagerImpl implements
@Override
public TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean includePropertyDefinitions,
- int depth) {
+ int depthParam) {
+ int depth = depthParam;
TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
if (null == typeManager) {
- throw new CmisInvalidArgumentException("Unknown repository " + repositoryId);
+ throw new CmisInvalidArgumentException(UNKNOWN_REPOSITORY + repositoryId);
}
TypeDefinitionContainer tc = typeManager.getTypeById(typeId);
@@ -212,7 +213,7 @@ public class StoreManagerImpl implements
boolean includePropertyDefinitions) {
TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
if (null == typeManager) {
- throw new CmisInvalidArgumentException("Unknown repository " + repositoryId);
+ throw new CmisInvalidArgumentException(UNKNOWN_REPOSITORY + repositoryId);
}
Collection<TypeDefinitionContainer> typeColl = getRootTypes(repositoryId, includePropertyDefinitions);
return typeColl;
@@ -223,7 +224,7 @@ public class StoreManagerImpl implements
List<TypeDefinitionContainer> result;
TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
if (null == typeManager) {
- throw new CmisInvalidArgumentException("Unknown repository " + repositoryId);
+ throw new CmisInvalidArgumentException(UNKNOWN_REPOSITORY + repositoryId);
}
List<TypeDefinitionContainer> rootTypes = typeManager.getRootTypes();
@@ -268,50 +269,18 @@ public class StoreManagerImpl implements
}
RepositoryInfo repoInfo = createRepositoryInfo(repositoryId);
-
return repoInfo;
}
public void clearTypeSystem(String repositoryId) {
TypeManagerImpl typeManager = fMapRepositoryToTypeManager.get(repositoryId);
if (null == typeManager) {
- throw new CmisInvalidArgumentException("Unknown repository " + repositoryId);
+ throw new CmisInvalidArgumentException(UNKNOWN_REPOSITORY + repositoryId);
}
typeManager.clearTypeSystem();
}
- public void initRepositoryInfo(String repositoryId, String repoInfoCreatorClassName) {
- RepositoryInfoCreator repoCreator = null;
-
- if (repoInfoCreatorClassName != null) {
- Object obj = null;
- try {
- obj = Class.forName(repoInfoCreatorClassName).newInstance();
- } catch (InstantiationException e) {
- throw new RuntimeException(
- "Illegal class to create type system, must implement RepositoryInfoCreator interface.", e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(
- "Illegal class to create type system, must implement RepositoryInfoCreator interface.", e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(
- "Illegal class to create type system, must implement RepositoryInfoCreator interface.", e);
- }
-
- if (obj instanceof RepositoryInfoCreator) {
- repoCreator = (RepositoryInfoCreator) obj;
- fRepositoryInfo = repoCreator.createRepositoryInfo();
- } else {
- throw new RuntimeException(
- "Illegal class to create repository info, must implement RepositoryInfoCreator interface.");
- }
- } else {
- // create a default repository info
- createRepositoryInfo(repositoryId);
- }
- }
-
public static List<TypeDefinition> initTypeSystem(String typeCreatorClassName) {
List<TypeDefinition> typesList = null;
@@ -323,20 +292,20 @@ public class StoreManagerImpl implements
try {
obj = Class.forName(typeCreatorClassName).newInstance();
} catch (InstantiationException e) {
- throw new RuntimeException(
+ throw new CmisRuntimeException(
"Illegal class to create type system, must implement TypeCreator interface.", e);
} catch (IllegalAccessException e) {
- throw new RuntimeException(
+ throw new CmisRuntimeException(
"Illegal class to create type system, must implement TypeCreator interface.", e);
} catch (ClassNotFoundException e) {
- throw new RuntimeException(
+ throw new CmisRuntimeException(
"Illegal class to create type system, must implement TypeCreator interface.", e);
}
if (obj instanceof TypeCreator) {
typeCreator = (TypeCreator) obj;
} else {
- throw new RuntimeException("Illegal class to create type system, must implement TypeCreator interface.");
+ throw new CmisRuntimeException("Illegal class to create type system, must implement TypeCreator interface.");
}
// retrieve the list of available types from the configured class.
@@ -352,7 +321,7 @@ public class StoreManagerImpl implements
List<TypeDefinition> typeDefs = null;
TypeManagerImpl typeManager = fMapRepositoryToTypeManager.get(repositoryId);
if (null == typeManager) {
- throw new RuntimeException("Unknown repository " + repositoryId);
+ throw new CmisObjectNotFoundException(UNKNOWN_REPOSITORY + repositoryId);
}
if (null != typeCreatorClassName) {
@@ -516,7 +485,6 @@ public class StoreManagerImpl implements
repoInfo.setCapabilities(caps);
- fRepositoryInfo = repoInfo;
return repoInfo;
}
@@ -600,9 +568,6 @@ public class StoreManagerImpl implements
ObjectList objList = queryProcessor.query(tm, objectStore, user, repositoryId, statement, searchAllVersions,
includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount);
- // LOG.debug("Query result, number of matching objects: " +
- // objList.getNumItems());
return objList;
}
-
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java Thu Aug 15 14:31:20 2013
@@ -50,6 +50,7 @@ import org.apache.chemistry.opencmis.inm
*/
public class StoredObjectImpl implements StoredObject {
+ private static final String UNKNOWN_USER = "unknown";
public static final String RENDITION_MIME_TYPE_JPEG = "image/jpeg";
public static final String RENDITION_MIME_TYPE_PNG = "image/png";
public static final String RENDITION_SUFFIX = "-rendition";
@@ -260,12 +261,7 @@ public class StoredObjectImpl implements
properties.put(PropertyIds.OBJECT_TYPE_ID,
objFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, getTypeId()));
}
- // set the base type id outside becaus it requires the type definition
- // if (FilterParser.isContainedInFilter(PropertyIds.CMIS_BASE_TYPE_ID,
- // requestedIds)) {
- // properties.add(objFactory.createPropertyIdData(PropertyIds.
- // CMIS_BASE_TYPE_ID, getBaseTypeId()));
- // }
+ // set the base type id PropertyIds.CMIS_BASE_TYPE_ID outside because it requires the type definition
if (FilterParser.isContainedInFilter(PropertyIds.CREATED_BY, requestedIds)) {
properties.put(PropertyIds.CREATED_BY,
objFactory.createPropertyStringData(PropertyIds.CREATED_BY, getCreatedBy()));
@@ -314,11 +310,10 @@ public class StoredObjectImpl implements
@Override
public void setCustomProperties(Map<String, PropertyData<?>> properties) {
- properties = new HashMap<String, PropertyData<?>>(properties); // get a
- // writable
- // collection
- removeAllSystemProperties(properties);
- setProperties(properties);
+ Map<String, PropertyData<?>> propertiesNew = new HashMap<String, PropertyData<?>>(properties);
+ // get a writablecollection
+ removeAllSystemProperties(propertiesNew);
+ setProperties(propertiesNew);
}
private static GregorianCalendar getNow() {
@@ -334,7 +329,7 @@ public class StoredObjectImpl implements
@SuppressWarnings("unchecked")
private void addSystemBaseProperties(Map<String, PropertyData<?>> properties, String user, boolean isCreated) {
if (user == null) {
- user = "unknown";
+ user = UNKNOWN_USER;
}
// Note that initial creation and modification date is set in
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java Thu Aug 15 14:31:20 2013
@@ -72,7 +72,7 @@ public class VersionedDocumentImpl exten
// checked-out. In AtomPub binding cancelCheckout
// mapped to a deleteVersion() call!
DocumentVersion pwc = getPwc();
- if (pwc == version) {
+ if (pwc == version) { //NOSONAR
cancelCheckOut(false); // note object is already deleted from
// map in ObjectStore
return !fVersions.isEmpty();
@@ -237,6 +237,8 @@ public class VersionedDocumentImpl exten
setName(nameLatestVer);
}
}
+ if (deleteInObjectStore) {
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java Thu Aug 15 14:31:20 2013
@@ -47,7 +47,8 @@ import org.apache.chemistry.opencmis.inm
import org.apache.chemistry.opencmis.server.support.TypeDefinitionFactory;
public class DefaultTypeSystemCreator implements TypeCreator {
- public static final List<TypeDefinition> singletonTypes = buildTypesList();
+ private static final String BUILTIN_IN_MEMORY_TYPE_DEFINITION_DESCR = "Builtin InMemory type definition ";
+ public static final List<TypeDefinition> SINGLETON_TYPES = buildTypesList();
public static final String COMPLEX_TYPE = "ComplexType";
public static final String TOPLEVEL_TYPE = "DocumentTopLevel";
public static final String VERSIONED_TYPE = "VersionableType";
@@ -62,15 +63,15 @@ public class DefaultTypeSystemCreator im
*/
@Override
public List<TypeDefinition> createTypesList() {
- return singletonTypes;
+ return SINGLETON_TYPES;
}
public static List<TypeDefinition> getTypesList() {
- return singletonTypes;
+ return SINGLETON_TYPES;
}
public static TypeDefinition getTypeById(String typeId) {
- for (TypeDefinition typeDef : singletonTypes) {
+ for (TypeDefinition typeDef : SINGLETON_TYPES) {
if (typeDef.getId().equals(typeId)) {
return typeDef;
}
@@ -269,14 +270,6 @@ public class DefaultTypeSystemCreator im
prop9.setDefaultValue(Collections.singletonList("blue"));
cmisComplexType.addPropertyDefinition(prop9);
- /*
- * try short form: / PropertyCreationHelper.addElemToPicklist(prop9,
- * "red"); PropertyCreationHelper.addElemToPicklist(prop9, "green");
- * PropertyCreationHelper.addElemToPicklist(prop9, "blue");
- * PropertyCreationHelper.addElemToPicklist(prop9, "black");
- * PropertyCreationHelper.setDefaultValue(prop9, "blue"); /
- */
-
// add type to types collection
typesList.add(cmisComplexType);
@@ -285,17 +278,17 @@ public class DefaultTypeSystemCreator im
cmisDocTypeTopLevel = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisDocumentType().getId());
cmisDocTypeTopLevel.setId(TOPLEVEL_TYPE);
cmisDocTypeTopLevel.setDisplayName("Document type with properties, Level 1");
- cmisDocTypeTopLevel.setDescription("Builtin InMemory type definition " + TOPLEVEL_TYPE);
+ cmisDocTypeTopLevel.setDescription(BUILTIN_IN_MEMORY_TYPE_DEFINITION_DESCR + TOPLEVEL_TYPE);
MutableTypeDefinition cmisDocTypeLevel1;
cmisDocTypeLevel1 = typeFactory.createChildTypeDefinition(cmisDocTypeTopLevel, LEVEL1_TYPE);
cmisDocTypeLevel1.setDisplayName("Document type with inherited properties, Level 2");
- cmisDocTypeLevel1 .setDescription("Builtin InMemory type definition " + LEVEL1_TYPE);
+ cmisDocTypeLevel1 .setDescription(BUILTIN_IN_MEMORY_TYPE_DEFINITION_DESCR + LEVEL1_TYPE);
MutableTypeDefinition cmisDocTypeLevel2;
cmisDocTypeLevel2 = typeFactory.createChildTypeDefinition(cmisDocTypeLevel1, LEVEL2_TYPE);
cmisDocTypeLevel2.setDisplayName("Document type with inherited properties, Level 3");
- cmisDocTypeLevel2.setDescription("Builtin InMemory type definition " + LEVEL2_TYPE);
+ cmisDocTypeLevel2.setDescription(BUILTIN_IN_MEMORY_TYPE_DEFINITION_DESCR + LEVEL2_TYPE);
PropertyStringDefinitionImpl propTop = PropertyCreationHelper.createStringDefinition("StringPropTopLevel",
"Sample String Property", Updatability.READWRITE);
@@ -319,8 +312,8 @@ public class DefaultTypeSystemCreator im
cmisVersionedType = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisDocumentType().getId());
cmisVersionedType.setId(VERSIONED_TYPE);
cmisVersionedType.setDisplayName("Versioned Type");
- cmisVersionedType.setDescription("Builtin InMemory type definition " + VERSIONED_TYPE);
- cmisVersionedType.setIsVersionable(true); // make it a versionable type;
+ cmisVersionedType.setDescription(BUILTIN_IN_MEMORY_TYPE_DEFINITION_DESCR + VERSIONED_TYPE);
+ cmisVersionedType.setIsVersionable(true); // make it a versionable type
// create a single String property definition
PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition("VersionedStringProp",
@@ -336,7 +329,7 @@ public class DefaultTypeSystemCreator im
itemType = typeFactory.createItemTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisItemType().getId());
itemType.setId(ITEM_TYPE);
itemType.setDisplayName("MyItemType");
- itemType.setDescription("Builtin InMemory type definition " + ITEM_TYPE);
+ itemType.setDescription(BUILTIN_IN_MEMORY_TYPE_DEFINITION_DESCR + ITEM_TYPE);
DocumentTypeCreationHelper.setDefaultTypeCapabilities(itemType);
// create a single String property definition
@@ -352,7 +345,7 @@ public class DefaultTypeSystemCreator im
cmisSecondaryType = typeFactory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisSecondaryType().getId());
cmisSecondaryType.setId(SECONDARY_TYPE_ID);
cmisSecondaryType.setDisplayName("MySecondaryType");
- cmisSecondaryType.setDescription("Builtin InMemory type definition " + SECONDARY_TYPE_ID);
+ cmisSecondaryType.setDescription(BUILTIN_IN_MEMORY_TYPE_DEFINITION_DESCR + SECONDARY_TYPE_ID);
DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisSecondaryType);
cmisSecondaryType.setIsFileable(false);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java Thu Aug 15 14:31:20 2013
@@ -43,6 +43,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed;
import org.apache.chemistry.opencmis.commons.enums.Updatability;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.FolderTypeDefinitionImpl;
@@ -58,7 +59,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeMutabilityImpl;
import org.apache.chemistry.opencmis.server.support.TypeDefinitionFactory;
-public class DocumentTypeCreationHelper {
+public final class DocumentTypeCreationHelper {
public static class InMemoryDocumentType extends DocumentTypeDefinitionImpl {
@@ -168,7 +169,7 @@ public class DocumentTypeCreationHelper
}
}
- private static final List<TypeDefinition> defaultTypes = createCmisDefaultTypes();
+ private static final List<TypeDefinition> DEFAULT_TYPES = createCmisDefaultTypes();
private static TypeDefinitionFactory typeFactory;
private static MutableDocumentTypeDefinition cmisTypeDoc;
private static MutableFolderTypeDefinition cmisTypeFolder;
@@ -240,12 +241,12 @@ public class DocumentTypeCreationHelper
public static List<TypeDefinition> createMapWithDefaultTypes() {
List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
- typesList.addAll(defaultTypes);
+ typesList.addAll(DEFAULT_TYPES);
return typesList;
}
public static final List<TypeDefinition> getDefaultTypes() {
- return defaultTypes;
+ return DEFAULT_TYPES;
}
private static void addPropertyDefinition(PropertyDefinition<?> propertyDefinition) {
@@ -284,43 +285,43 @@ public class DocumentTypeCreationHelper
}
private static List<TypeDefinition> createCmisDefaultTypes() {
- TypeDefinitionFactory typeFactory = getTypeDefinitionFactory();
+ TypeDefinitionFactory typeFactoryLocal = getTypeDefinitionFactory();
List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
// create root types:
try {
- cmisTypeDoc = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, null);
+ cmisTypeDoc = typeFactoryLocal.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, null);
setDefaultTypeCapabilities(cmisTypeDoc);
cmisTypeDoc.setTypeMutability(getBaseTypeMutability());
cmisTypeDoc.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);
cmisTypeDoc.setIsVersionable(false);
typesList.add(cmisTypeDoc);
- cmisTypeFolder = typeFactory.createFolderTypeDefinition(CmisVersion.CMIS_1_1, null);
+ cmisTypeFolder = typeFactoryLocal.createFolderTypeDefinition(CmisVersion.CMIS_1_1, null);
setDefaultTypeCapabilities(cmisTypeFolder);
cmisTypeFolder.setTypeMutability(getBaseTypeMutability());
typesList.add(cmisTypeFolder);
- cmisTypeRel = typeFactory.createRelationshipTypeDefinition(CmisVersion.CMIS_1_1, null);
+ cmisTypeRel = typeFactoryLocal.createRelationshipTypeDefinition(CmisVersion.CMIS_1_1, null);
setDefaultTypeCapabilities(cmisTypeRel);
cmisTypeRel.setTypeMutability(getBaseTypeMutability());
cmisTypeRel.setIsFileable(false);
typesList.add(cmisTypeRel);
- cmisTypePolicy = typeFactory.createPolicyTypeDefinition(CmisVersion.CMIS_1_1, null);
+ cmisTypePolicy = typeFactoryLocal.createPolicyTypeDefinition(CmisVersion.CMIS_1_1, null);
setDefaultTypeCapabilities(cmisTypePolicy);
cmisTypePolicy.setTypeMutability(getBaseTypeMutability());
cmisTypePolicy.setIsFileable(false);
typesList.add(cmisTypePolicy);
- cmisTypeItem = typeFactory.createItemTypeDefinition(CmisVersion.CMIS_1_1, null);
+ cmisTypeItem = typeFactoryLocal.createItemTypeDefinition(CmisVersion.CMIS_1_1, null);
setDefaultTypeCapabilities(cmisTypeItem);
cmisTypeItem.setTypeMutability(getBaseTypeMutability());
cmisTypeItem.setIsFileable(true);
typesList.add(cmisTypeItem);
- cmisTypeSecondary = typeFactory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1, null);
+ cmisTypeSecondary = typeFactoryLocal.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1, null);
setDefaultTypeCapabilities(cmisTypeSecondary);
cmisTypeSecondary.setTypeMutability(getBaseTypeMutability());
cmisTypeSecondary.setIsFileable(false);
@@ -338,7 +339,7 @@ public class DocumentTypeCreationHelper
typeFactory.setDefaultControllableAcl(true);
typeFactory.setDefaultControllablePolicy(true);
typeFactory.setDefaultNamespace("http://apache.org");
- // typeFactory.setDefaultIsFulltextIndexed(false);
+ typeFactory.setDefaultIsFulltextIndexed(false);
typeFactory.setDefaultQueryable(true);
TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
typeMutability.setCanCreate(true);
@@ -516,23 +517,13 @@ public class DocumentTypeCreationHelper
propId = PropertyCreationHelper.createIdDefinition(PropertyIds.TARGET_ID, "Target Id", Updatability.READWRITE);
propId.setIsRequired(true);
propertyDefinitions.put(propId.getId(), propId);
-
-// propId = PropertyCreationHelper.createIdMultiDefinition(PropertyIds.,
-// "allowedSourceTypes", Updatability.READWRITE);
-// propId.setIsRequired(false);
-// propertyDefinitions.put(propId.getId(), propId);
-//
-// propId = PropertyCreationHelper.createIdMultiDefinition(PropertyIds.,
-// "allowedTargetTypes", Updatability.READWRITE);
-// propId.setIsRequired(false);
-// propertyDefinitions.put(propId.getId(), propId);
}
public static void mergePropertyDefinitions(Map<String, PropertyDefinition<?>> existingPpropertyDefinitions,
Map<String, PropertyDefinition<?>> newPropertyDefinitions) {
for (String propId : newPropertyDefinitions.keySet()) {
if (existingPpropertyDefinitions.containsKey(propId)) {
- throw new RuntimeException("You can't set a property with id " + propId
+ throw new CmisInvalidArgumentException("You can't set a property with id " + propId
+ ". This property id already exists already or exists in supertype");
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java Thu Aug 15 14:31:20 2013
@@ -45,6 +45,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.Updatability;
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyData;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyDefinition;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
@@ -86,7 +87,7 @@ import org.slf4j.LoggerFactory;
*/
public final class PropertyCreationHelper {
- private static final Logger log = LoggerFactory.getLogger(PropertyCreationHelper.class);
+ private static final Logger LOG = LoggerFactory.getLogger(PropertyCreationHelper.class);
private PropertyCreationHelper() {
}
@@ -225,7 +226,7 @@ public final class PropertyCreationHelpe
}
if (FilterParser.isContainedInFilter(PropertyIds.BASE_TYPE_ID, requestedIds)) {
if (td == null) {
- log.warn("getPropertiesFromObject(), cannot get type definition, a type with id " + typeId
+ LOG.warn("getPropertiesFromObject(), cannot get type definition, a type with id " + typeId
+ " is unknown");
return null;
} else {
@@ -349,12 +350,7 @@ public final class PropertyCreationHelpe
if (!funcEntry.getKey().equals("SCORE"))
queryName = funcEntry.getKey();
- // PropertyDecimal pd =
- // objFactory.createPropertyDecimalData(queryName,
- // BigDecimal.valueOf(1.0));
- // does not give me an impl class, so directly use it
PropertyDecimalImpl pd = new PropertyDecimalImpl();
-
// fixed dummy value
pd.setValue(BigDecimal.valueOf(1.0));
pd.setId(queryName);
@@ -467,8 +463,6 @@ public final class PropertyCreationHelpe
// fill output object
if (null != includeAllowableActions && includeAllowableActions) {
- // AllowableActions allowableActions =
- // DataObjectCreator.fillAllowableActions(so, user);
AllowableActions allowableActions = so.getAllowableActions(user);
od.setAllowableActions(allowableActions);
}
@@ -602,7 +596,7 @@ public final class PropertyCreationHelpe
clone.setValues(((PropertyUriImpl) prop).getValues());
ad = clone;
} else {
- throw new RuntimeException("Unknown property type: " + prop.getClass());
+ throw new CmisRuntimeException("Unknown property type: " + prop.getClass());
}
ad.setDisplayName(prop.getDisplayName());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeDefinitions.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeDefinitions.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeDefinitions.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeDefinitions.java Thu Aug 15 14:31:20 2013
@@ -30,7 +30,7 @@ import org.apache.chemistry.opencmis.com
@XmlRootElement
public class TypeDefinitions {
- protected List<CmisTypeDefinitionType> type;
+ private List<CmisTypeDefinitionType> type;
@XmlElement(namespace = XMLConstants.NAMESPACE_RESTATOM, name = "type")
public List<CmisTypeDefinitionType> getTypeDefinitions() {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeUtil.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeUtil.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeUtil.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeUtil.java Thu Aug 15 14:31:20 2013
@@ -52,6 +52,9 @@ import org.apache.chemistry.opencmis.com
public final class TypeUtil {
+ private TypeUtil() {
+ }
+
public static TypeDefinition cloneType(TypeDefinition type) {
if (type instanceof DocumentTypeDefinition)
return cloneTypeDoc((DocumentTypeDefinition) type);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties Thu Aug 15 14:31:20 2013
@@ -25,8 +25,8 @@ InMemoryServer.User=dummyuser
InMemoryServer.Password=dummysecret
InMemoryServer.TypesCreatorClass=org.apache.chemistry.opencmis.inmemory.types.DefaultTypeSystemCreator
InMemoryServer.TypeDefinitionsFile=types.xml
-InMemoryServer.Class=org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerImpl
-# InMemoryServer.Class=org.apache.chemistry.opencmis.inmemory.storedobj.dbimpl.StoreManagerImpl
+# InMemoryServer.Class=org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerImpl
+InMemoryServer.Class=org.apache.chemistry.opencmis.inmemory.storedobj.dbimpl.StoreManagerImpl
# InMemoryServer.MemoryThreshold=10485760
# InMemoryServer.TempDir=/path/to/your/tmp
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java Thu Aug 15 14:31:20 2013
@@ -262,7 +262,12 @@ public class AclTest {
@Test
public void testCloneAcl() {
InMemoryAcl acl = createDefaultAcl();
- InMemoryAcl acl2 = acl.clone();
+ InMemoryAcl acl2 = null;
+ try {
+ acl2 = acl.clone();
+ } catch (CloneNotSupportedException e) {
+ fail("Clone not supported");
+ }
assertFalse(acl == acl2);
assertEquals(acl, acl2);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java Thu Aug 15 14:31:20 2013
@@ -210,7 +210,7 @@ public class ObjectServiceTest extends A
}
try {
- createDocumentNoCatch("/(%#$aöÃ", fRootFolderId, DOCUMENT_TYPE_ID, VersioningState.NONE, false);
+ createDocumentNoCatch("/(%#$a����", fRootFolderId, DOCUMENT_TYPE_ID, VersioningState.NONE, false);
fail("Document creation with ilegal name should fail.");
} catch (Exception e) {
assertTrue(e instanceof CmisInvalidArgumentException);
@@ -242,7 +242,7 @@ public class ObjectServiceTest extends A
}
try {
- createFolderNoCatch("/(%#$���������������������������", fRootFolderId, FOLDER_TYPE_ID);
+ createFolderNoCatch("/(%#$���������������������������������������������������������������������������������", fRootFolderId, FOLDER_TYPE_ID);
fail("Folder creation with ilegal name should fail.");
} catch (Exception e) {
assertTrue(e instanceof CmisInvalidArgumentException);
@@ -929,10 +929,10 @@ public class ObjectServiceTest extends A
log.info("starting testGetObjectByPath() with specal chars...");
log.info(" creating object");
- String docID = createDocument("Hänschen", fRootFolderId, false);
+ String docID = createDocument("H��nschen", fRootFolderId, false);
log.info(" getting object by path with special chars");
try {
- ObjectData res = fObjSvc.getObjectByPath(fRepositoryId, "/Hänschen", "*", false, IncludeRelationships.NONE, null, false,
+ ObjectData res = fObjSvc.getObjectByPath(fRepositoryId, "/H��nschen", "*", false, IncludeRelationships.NONE, null, false,
false, null);
assertNotNull(res);
assertNotNull(res.getId());
@@ -987,13 +987,13 @@ public class ObjectServiceTest extends A
}
try {
- ContentStream contentStream = createContent(MAX_SIZE + 1);
+ ContentStream contentStream = createContent(MAX_SIZE + 1, MAX_SIZE, null);
Properties props = createDocumentProperties("TestMaxContentSize", DOCUMENT_TYPE_ID);
fObjSvc.createDocument(fRepositoryId, props, fRootFolderId, contentStream, VersioningState.NONE, null,
null, null, null);
fail("createDocument with exceeded content size should fail.");
} catch (CmisInvalidArgumentException e) {
- log.debug("createDocument with exceeded failed as excpected.");
+ log.debug("createDocument with exceeded failed as expected.");
} catch (Exception e1) {
log.debug("createDocument with exceeded failed with wrong exception (expected CmisInvalidArgumentException, got "
+ e1.getClass().getName() + ").");
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java Thu Aug 15 14:31:20 2013
@@ -62,7 +62,6 @@ public class TypeValidator {
}
private static boolean isMandatorySystemProperty(String propertyId) {
- // TODO Auto-generated method stub
return propertyId.equals(PropertyIds.OBJECT_TYPE_ID);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalCalculator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalCalculator.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalCalculator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalCalculator.java Thu Aug 15 14:31:20 2013
@@ -23,6 +23,7 @@ package org.apache.chemistry.opencmis.ut
import java.awt.Color;
import java.awt.image.BufferedImage;
+import java.util.Arrays;
final class FractalCalculator {
private int[] colorMap;
@@ -48,7 +49,7 @@ final class FractalCalculator {
newRect = complRect;
imageWidth = imgWidth;
imageHeight = imgHeight;
- colorMap = colMap;
+ colorMap = Arrays.copyOf(colMap, colMap.length);
numColors = colorMap.length;
rRangeMin = newRect.getRMin();
rRangeMax = newRect.getRMax();
Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java Thu Aug 15 14:31:20 2013
@@ -219,12 +219,12 @@ public class LoremIpsum {
initializeDictionary(this.dictionary);
};
- public LoremIpsum(String sample, String[] dictionary) {
+ public LoremIpsum(String sample, String[] newDictionary) {
this.sample = sample;
this.dictionary = null;
generateChains(this.sample);
generateStatistics(this.sample);
- initializeDictionary(dictionary);
+ initializeDictionary(newDictionary);
};
public LoremIpsum(String sample) {