Return-Path: Delivered-To: apmail-incubator-chemistry-commits-archive@minotaur.apache.org Received: (qmail 41681 invoked from network); 22 Apr 2010 16:29:43 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Apr 2010 16:29:43 -0000 Received: (qmail 73879 invoked by uid 500); 22 Apr 2010 16:29:43 -0000 Delivered-To: apmail-incubator-chemistry-commits-archive@incubator.apache.org Received: (qmail 73853 invoked by uid 500); 22 Apr 2010 16:29:43 -0000 Mailing-List: contact chemistry-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: chemistry-dev@incubator.apache.org Delivered-To: mailing list chemistry-commits@incubator.apache.org Received: (qmail 73845 invoked by uid 99); 22 Apr 2010 16:29:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Apr 2010 16:29:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Apr 2010 16:29:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C7A3A2388C0E; Thu, 22 Apr 2010 16:28:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r936938 [17/29] - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server: chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ chemistry-opencmis-server-bindings/src/main/java/org/apache/chem... Date: Thu, 22 Apr 2010 16:28:00 -0000 To: chemistry-commits@incubator.apache.org From: dcaruana@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100422162803.C7A3A2388C0E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ServiceFactory.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ServiceFactory.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ServiceFactory.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ServiceFactory.java Thu Apr 22 16:27:57 2010 @@ -55,239 +55,239 @@ import org.apache.commons.logging.LogFac public class ServiceFactory extends AbstractServicesFactory { - private static final Log LOG = LogFactory.getLog(ServiceFactory.class.getName()); - private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(1000); - private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(100); - private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(2); - private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(-1); - - private StoreManager fStoreManager; // singleton root of everything - - private CmisRepositoryService fRepositoryService; - private CmisNavigationService fNavigationService; - private CmisObjectService fObjectService; - private CmisVersioningService fVersioningService; - private CmisDiscoveryService fDiscoveryService; - InMemoryRepositoryServiceImpl fRepSvc; - InMemoryObjectServiceImpl fObjSvc; - InMemoryNavigationServiceImpl fNavSvc; - - public StoreManager getStoreManager() { - return fStoreManager; - } - - @Override - public void init(Map parameters) { - LOG.info("Initializing in-memory repository..."); - - // initialize in-memory management - String repositoryClassName = (String) parameters.get(ConfigConstants.REPOSITORY_CLASS); - if (null == repositoryClassName) - repositoryClassName = StoreManagerImpl.class.getName(); - - if (null == fStoreManager) - fStoreManager = StoreManagerFactory.createInstance(repositoryClassName); - - String repositoryId = parameters.get(ConfigConstants.REPOSITORY_ID); - - List allAvailableRepositories = fStoreManager.getAllRepositoryIds(); - - // init existing repositories - for (String existingRepId : allAvailableRepositories) - fStoreManager.initRepository(existingRepId); - - // create repository if configured as a startup parameter - if (null != repositoryId) { - if (allAvailableRepositories.contains(repositoryId)) - LOG.warn("Repostory " + repositoryId + " already exists and will not be created."); - else { - String typeCreatorClassName = parameters.get(ConfigConstants.TYPE_CREATOR_CLASS); - fStoreManager.createAndInitRepository(repositoryId, typeCreatorClassName); - } - } - - fRepSvc = new InMemoryRepositoryServiceImpl(fStoreManager); - fNavSvc = new InMemoryNavigationServiceImpl(fStoreManager); - fObjSvc = new InMemoryObjectServiceImpl(fStoreManager); - InMemoryVersioningServiceImpl verSvc = new InMemoryVersioningServiceImpl(fStoreManager, fObjSvc); - InMemoryDiscoveryServiceImpl disSvc = new InMemoryDiscoveryServiceImpl(fStoreManager, fRepSvc, fNavSvc); - - // Initialize services, use the service wrappers to provide suitable - // default parameters and - // paging sets - fRepositoryService = new RepositoryServiceWrapper(fRepSvc, DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES); - fNavigationService = new NavigationServiceWrapper(fNavSvc, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS); - fObjectService = new ObjectServiceWrapper(fObjSvc, DEFAULT_MAX_ITEMS_OBJECTS); - fVersioningService = new VersioningServiceWrapper(verSvc); - fDiscoveryService = new DiscoveryServiceWrapper(disSvc, DEFAULT_MAX_ITEMS_OBJECTS); - - // With some special configuration settings fill the repository with - // some documents and folders - // if is empty - if (!allAvailableRepositories.contains(repositoryId)) - fillRepositoryIfConfigured(parameters, repositoryId); - - LOG.info("...initialized in-memory repository."); - } - - @Override - public void destroy() { - LOG.info("Destroyed in-memory repository."); - } - - @Override - public CmisRepositoryService getRepositoryService() { - return fRepositoryService; - } - - @Override - public CmisNavigationService getNavigationService() { - return fNavigationService; - } - - @Override - public CmisObjectService getObjectService() { - return fObjectService; - } - - @Override - public CmisVersioningService getVersioningService() { - return fVersioningService; - } - - @Override - public CmisDiscoveryService getDiscoveryService() { - return fDiscoveryService; - } - - private void fillRepositoryIfConfigured(Map parameters, String repositoryId) { - class DummyCallContext implements CallContext { - - public String get(String key) { - return null; - } - - public String getBinding() { - return null; - } - - public boolean isObjectInfoRequired() { - return false; - } - - public String getRepositoryId() { - return null; - } - - public String getLocale() { - return null; - } - - public String getPassword() { - return null; - } - - public String getUsername() { - return null; - } - } - - String doFillRepositoryStr = parameters.get(ConfigConstants.USE_REPOSITORY_FILER); - boolean doFillRepository = doFillRepositoryStr == null ? false : Boolean.parseBoolean(doFillRepositoryStr); - - if (!doFillRepository) - return; - - BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl(); - NavigationService navSvc = new NavigationServiceImpl(fNavSvc); - ObjectService objSvc = new ObjectServiceImpl(fObjSvc); - RepositoryService repSvc = new RepositoryServiceImpl(fRepSvc); - - String levelsStr = parameters.get(ConfigConstants.FILLER_DEPTH); - int levels = 1; - if (null != levelsStr) - levels = Integer.parseInt(levelsStr); - - String docsPerLevelStr = parameters.get(ConfigConstants.FILLER_DOCS_PER_FOLDER); - int docsPerLevel = 1; - if (null != docsPerLevelStr) - docsPerLevel = Integer.parseInt(docsPerLevelStr); - - String childrenPerLevelStr = parameters.get(ConfigConstants.FILLER_FOLDERS_PER_FOLDER); - int childrenPerLevel = 2; - if (null != childrenPerLevelStr) - childrenPerLevel = Integer.parseInt(childrenPerLevelStr); - - String documentTypeId = parameters.get(ConfigConstants.FILLER_DOCUMENT_TYPE_ID); - if (null == documentTypeId) - documentTypeId = BaseTypeId.CMIS_DOCUMENT.value(); - - String folderTypeId = parameters.get(ConfigConstants.FILLER_FOLDER_TYPE_ID); - if (null == folderTypeId) - folderTypeId = BaseTypeId.CMIS_FOLDER.value(); - - int contentSizeKB = 0; - String contentSizeKBStr = parameters.get(ConfigConstants.FILLER_CONTENT_SIZE); - if (null != contentSizeKBStr) - contentSizeKB = Integer.parseInt(contentSizeKBStr); - - // Create a hierarchy of folders and fill it with some documents - ObjectGenerator gen = new ObjectGenerator(objectFactory, navSvc, objSvc, repositoryId); - - gen.setNumberOfDocumentsToCreatePerFolder(docsPerLevel); - - // Set the type id for all created documents: - gen.setDocumentTypeId(documentTypeId); - - // Set the type id for all created folders: - gen.setFolderTypeId(folderTypeId); - - // Set contentSize - gen.setContentSizeInKB(contentSizeKB); - - // set properties that need to be filled - // set the properties the generator should fill with values for - // documents: - // Note: must be valid properties in configured document and folder type - - List propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_DOCUMENT_PROPERTY); - if (null != propsToSet) - gen.setDocumentPropertiesToGenerate(propsToSet); - - propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_FOLDER_PROPERTY); - if (null != propsToSet) - gen.setFolderPropertiesToGenerate(propsToSet); - - // Simulate a runtime context with configuration parameters - // Attach the CallContext to a thread local context that can be accessed - // from everywhere -// RuntimeContext.attachCfg(new DummyCallContext()); - - // Build the tree - RepositoryInfo rep = repSvc.getRepositoryInfo(repositoryId, null); - String rootFolderId = rep.getRootFolderId(); - - try { - gen.createFolderHierachy(levels, childrenPerLevel, rootFolderId); - // Dump the tree - gen.dumpFolder(rootFolderId, "*"); - } catch (Exception e) { - LOG.error("Could not create folder hierarchy with documents. " + e); - e.printStackTrace(); - } - - } - - private List readPropertiesToSetFromConfig(Map parameters, String keyPrefix) { - List propsToSet = new ArrayList(); - for (int i = 0;; ++i) { - String propertyKey = keyPrefix + Integer.toString(i); - String propertyToAdd = parameters.get(propertyKey); - if (null == propertyToAdd) - break; - else - propsToSet.add(propertyToAdd); - } - return propsToSet; - } + private static final Log LOG = LogFactory.getLog(ServiceFactory.class.getName()); + private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(1000); + private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(100); + private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(2); + private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(-1); + + private StoreManager fStoreManager; // singleton root of everything + + private CmisRepositoryService fRepositoryService; + private CmisNavigationService fNavigationService; + private CmisObjectService fObjectService; + private CmisVersioningService fVersioningService; + private CmisDiscoveryService fDiscoveryService; + InMemoryRepositoryServiceImpl fRepSvc; + InMemoryObjectServiceImpl fObjSvc; + InMemoryNavigationServiceImpl fNavSvc; + + public StoreManager getStoreManager() { + return fStoreManager; + } + + @Override + public void init(Map parameters) { + LOG.info("Initializing in-memory repository..."); + + // initialize in-memory management + String repositoryClassName = (String) parameters.get(ConfigConstants.REPOSITORY_CLASS); + if (null == repositoryClassName) + repositoryClassName = StoreManagerImpl.class.getName(); + + if (null == fStoreManager) + fStoreManager = StoreManagerFactory.createInstance(repositoryClassName); + + String repositoryId = parameters.get(ConfigConstants.REPOSITORY_ID); + + List allAvailableRepositories = fStoreManager.getAllRepositoryIds(); + + // init existing repositories + for (String existingRepId : allAvailableRepositories) + fStoreManager.initRepository(existingRepId); + + // create repository if configured as a startup parameter + if (null != repositoryId) { + if (allAvailableRepositories.contains(repositoryId)) + LOG.warn("Repostory " + repositoryId + " already exists and will not be created."); + else { + String typeCreatorClassName = parameters.get(ConfigConstants.TYPE_CREATOR_CLASS); + fStoreManager.createAndInitRepository(repositoryId, typeCreatorClassName); + } + } + + fRepSvc = new InMemoryRepositoryServiceImpl(fStoreManager); + fNavSvc = new InMemoryNavigationServiceImpl(fStoreManager); + fObjSvc = new InMemoryObjectServiceImpl(fStoreManager); + InMemoryVersioningServiceImpl verSvc = new InMemoryVersioningServiceImpl(fStoreManager, fObjSvc); + InMemoryDiscoveryServiceImpl disSvc = new InMemoryDiscoveryServiceImpl(fStoreManager, fRepSvc, fNavSvc); + + // Initialize services, use the service wrappers to provide suitable + // default parameters and + // paging sets + fRepositoryService = new RepositoryServiceWrapper(fRepSvc, DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES); + fNavigationService = new NavigationServiceWrapper(fNavSvc, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS); + fObjectService = new ObjectServiceWrapper(fObjSvc, DEFAULT_MAX_ITEMS_OBJECTS); + fVersioningService = new VersioningServiceWrapper(verSvc); + fDiscoveryService = new DiscoveryServiceWrapper(disSvc, DEFAULT_MAX_ITEMS_OBJECTS); + + // With some special configuration settings fill the repository with + // some documents and folders + // if is empty + if (!allAvailableRepositories.contains(repositoryId)) + fillRepositoryIfConfigured(parameters, repositoryId); + + LOG.info("...initialized in-memory repository."); + } + + @Override + public void destroy() { + LOG.info("Destroyed in-memory repository."); + } + + @Override + public CmisRepositoryService getRepositoryService() { + return fRepositoryService; + } + + @Override + public CmisNavigationService getNavigationService() { + return fNavigationService; + } + + @Override + public CmisObjectService getObjectService() { + return fObjectService; + } + + @Override + public CmisVersioningService getVersioningService() { + return fVersioningService; + } + + @Override + public CmisDiscoveryService getDiscoveryService() { + return fDiscoveryService; + } + + private void fillRepositoryIfConfigured(Map parameters, String repositoryId) { + class DummyCallContext implements CallContext { + + public String get(String key) { + return null; + } + + public String getBinding() { + return null; + } + + public boolean isObjectInfoRequired() { + return false; + } + + public String getRepositoryId() { + return null; + } + + public String getLocale() { + return null; + } + + public String getPassword() { + return null; + } + + public String getUsername() { + return null; + } + } + + String doFillRepositoryStr = parameters.get(ConfigConstants.USE_REPOSITORY_FILER); + boolean doFillRepository = doFillRepositoryStr == null ? false : Boolean.parseBoolean(doFillRepositoryStr); + + if (!doFillRepository) + return; + + BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl(); + NavigationService navSvc = new NavigationServiceImpl(fNavSvc); + ObjectService objSvc = new ObjectServiceImpl(fObjSvc); + RepositoryService repSvc = new RepositoryServiceImpl(fRepSvc); + + String levelsStr = parameters.get(ConfigConstants.FILLER_DEPTH); + int levels = 1; + if (null != levelsStr) + levels = Integer.parseInt(levelsStr); + + String docsPerLevelStr = parameters.get(ConfigConstants.FILLER_DOCS_PER_FOLDER); + int docsPerLevel = 1; + if (null != docsPerLevelStr) + docsPerLevel = Integer.parseInt(docsPerLevelStr); + + String childrenPerLevelStr = parameters.get(ConfigConstants.FILLER_FOLDERS_PER_FOLDER); + int childrenPerLevel = 2; + if (null != childrenPerLevelStr) + childrenPerLevel = Integer.parseInt(childrenPerLevelStr); + + String documentTypeId = parameters.get(ConfigConstants.FILLER_DOCUMENT_TYPE_ID); + if (null == documentTypeId) + documentTypeId = BaseTypeId.CMIS_DOCUMENT.value(); + + String folderTypeId = parameters.get(ConfigConstants.FILLER_FOLDER_TYPE_ID); + if (null == folderTypeId) + folderTypeId = BaseTypeId.CMIS_FOLDER.value(); + + int contentSizeKB = 0; + String contentSizeKBStr = parameters.get(ConfigConstants.FILLER_CONTENT_SIZE); + if (null != contentSizeKBStr) + contentSizeKB = Integer.parseInt(contentSizeKBStr); + + // Create a hierarchy of folders and fill it with some documents + ObjectGenerator gen = new ObjectGenerator(objectFactory, navSvc, objSvc, repositoryId); + + gen.setNumberOfDocumentsToCreatePerFolder(docsPerLevel); + + // Set the type id for all created documents: + gen.setDocumentTypeId(documentTypeId); + + // Set the type id for all created folders: + gen.setFolderTypeId(folderTypeId); + + // Set contentSize + gen.setContentSizeInKB(contentSizeKB); + + // set properties that need to be filled + // set the properties the generator should fill with values for + // documents: + // Note: must be valid properties in configured document and folder type + + List propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_DOCUMENT_PROPERTY); + if (null != propsToSet) + gen.setDocumentPropertiesToGenerate(propsToSet); + + propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_FOLDER_PROPERTY); + if (null != propsToSet) + gen.setFolderPropertiesToGenerate(propsToSet); + + // Simulate a runtime context with configuration parameters + // Attach the CallContext to a thread local context that can be accessed + // from everywhere + // RuntimeContext.attachCfg(new DummyCallContext()); + + // Build the tree + RepositoryInfo rep = repSvc.getRepositoryInfo(repositoryId, null); + String rootFolderId = rep.getRootFolderId(); + + try { + gen.createFolderHierachy(levels, childrenPerLevel, rootFolderId); + // Dump the tree + gen.dumpFolder(rootFolderId, "*"); + } catch (Exception e) { + LOG.error("Could not create folder hierarchy with documents. " + e); + e.printStackTrace(); + } + + } + + private List readPropertiesToSetFromConfig(Map parameters, String keyPrefix) { + List propsToSet = new ArrayList(); + for (int i = 0;; ++i) { + String propertyKey = keyPrefix + Integer.toString(i); + String propertyToAdd = parameters.get(propertyKey); + if (null == propertyToAdd) + break; + else + propsToSet.add(propertyToAdd); + } + return propsToSet; + } } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java Thu Apr 22 16:27:57 2010 @@ -28,65 +28,65 @@ import java.util.List; */ public interface Children { - /** - * Create a subfolder in an existing folder. This call persists parent and - * child folder as transactional step. - * - * @param folder - * new child folder - */ - public void addChildFolder(Folder folder); - - /** - * Add a document to a folder. This call persists the folder and the - * document as a transactional step. - * - * @param doc - * document to be added - */ - public void addChildDocument(Document doc); - - /** - * Add a versioned document to a folder. This call persists the folder and - * the document as a transactional step. - * - * @param doc - * document to be added - */ - public void addChildDocument(VersionedDocument doc); - - /** - * get all the children of this folder. To support paging an initial offset - * and a maximum number of children to retrieve can be passed - * - * @param maxItems - * max. number of items to return - * @param skipCount - * initial offset where to start fetching - * @return list of children objects - */ - public List getChildren(int maxItems, int skipCount); - - /** - * get all the children of this folder which are folders. To support paging - * an initial offset and a maximum number of childrent to retrieve can be - * passed. - * - * @param maxItems - * max. number of items to return - * @param skipCount - * initial offset where to start fetching - * @return list of children folders - */ - public List getFolderChildren(int maxItems, int skipCount); - - /** - * indicate if a child with the given name exists in this folder - * - * @param name - * name to check - * @return true if the name exists in the folderas child, false otherwise - */ - public boolean hasChild(String name); + /** + * Create a subfolder in an existing folder. This call persists parent and + * child folder as transactional step. + * + * @param folder + * new child folder + */ + public void addChildFolder(Folder folder); + + /** + * Add a document to a folder. This call persists the folder and the + * document as a transactional step. + * + * @param doc + * document to be added + */ + public void addChildDocument(Document doc); + + /** + * Add a versioned document to a folder. This call persists the folder and + * the document as a transactional step. + * + * @param doc + * document to be added + */ + public void addChildDocument(VersionedDocument doc); + + /** + * get all the children of this folder. To support paging an initial offset + * and a maximum number of children to retrieve can be passed + * + * @param maxItems + * max. number of items to return + * @param skipCount + * initial offset where to start fetching + * @return list of children objects + */ + public List getChildren(int maxItems, int skipCount); + + /** + * get all the children of this folder which are folders. To support paging + * an initial offset and a maximum number of childrent to retrieve can be + * passed. + * + * @param maxItems + * max. number of items to return + * @param skipCount + * initial offset where to start fetching + * @return list of children folders + */ + public List getFolderChildren(int maxItems, int skipCount); + + /** + * indicate if a child with the given name exists in this folder + * + * @param name + * name to check + * @return true if the name exists in the folderas child, false otherwise + */ + public boolean hasChild(String name); } \ No newline at end of file Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Content.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Content.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Content.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Content.java Thu Apr 22 16:27:57 2010 @@ -22,31 +22,31 @@ import org.apache.chemistry.opencmis.com public interface Content { - /** - * return true if this object has content or false if there is no content - * attached. - * - * @return - */ - boolean hasContent(); + /** + * return true if this object has content or false if there is no content + * attached. + * + * @return + */ + boolean hasContent(); - /** - * retrieve the content of a document - * - * @return object containing mime-type, length and a stream with content - */ - ContentStream getContent(long offset, long length); + /** + * retrieve the content of a document + * + * @return object containing mime-type, length and a stream with content + */ + ContentStream getContent(long offset, long length); - /** - * Assign content do a document. Existing content gets overwritten. The - * document is not yet persisted in the new state. - * - * @param content - * content to be assigned to the document. - * @param mustPersist - * persist document (set to false if content is set during - * creation of a document) - */ - void setContent(ContentStream content, boolean mustPersist); + /** + * Assign content do a document. Existing content gets overwritten. The + * document is not yet persisted in the new state. + * + * @param content + * content to be assigned to the document. + * @param mustPersist + * persist document (set to false if content is set during + * creation of a document) + */ + void setContent(ContentStream content, boolean mustPersist); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Filing.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Filing.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Filing.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Filing.java Thu Apr 22 16:27:57 2010 @@ -31,27 +31,27 @@ import java.util.List; */ public interface Filing { - /** - * character indicating how folders are separated within a path string. This - * char must not be a valid character of an object name. - */ - public static final String PATH_SEPARATOR = "/"; + /** + * character indicating how folders are separated within a path string. This + * char must not be a valid character of an object name. + */ + public static final String PATH_SEPARATOR = "/"; - /** - * return a list of parents. for single parent object this list must contain - * only one element. returns an empty list if this is an unfiled document. - * - * @return list of parent folders - */ - List getParents(); + /** + * return a list of parents. for single parent object this list must contain + * only one element. returns an empty list if this is an unfiled document. + * + * @return list of parent folders + */ + List getParents(); - /** - * Move an object to a different folder. Source and target object are - * persisted in this call as part of a transactional step. - * - * @param newParent - * new parent folder for the object - */ - public void move(Folder oldParent, Folder newParent); + /** + * Move an object to a different folder. Source and target object are + * persisted in this call as part of a transactional step. + * + * @param newParent + * new parent folder for the object + */ + public void move(Folder oldParent, Folder newParent); } \ No newline at end of file Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Folder.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Folder.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Folder.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Folder.java Thu Apr 22 16:27:57 2010 @@ -31,11 +31,11 @@ import java.util.List; public interface Folder extends Children, SingleFiling, StoredObject { - /** - * return a list of allowed types of children in this folder - * - * @return - */ - List getAllowedChildObjectTypeIds(); + /** + * return a list of allowed types of children in this folder + * + * @return + */ + List getAllowedChildObjectTypeIds(); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/MultiFiling.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/MultiFiling.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/MultiFiling.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/MultiFiling.java Thu Apr 22 16:27:57 2010 @@ -29,26 +29,26 @@ import java.util.List; */ public interface MultiFiling extends Filing { - /** - * retrieve the path segment of this folder - * - * @return - */ - String getPathSegment(); + /** + * retrieve the path segment of this folder + * + * @return + */ + String getPathSegment(); - /** - * Add this document to a new parent folder as child object - * - * @param parent - * new parent folder of the document. - */ - void addParent(Folder parent); + /** + * Add this document to a new parent folder as child object + * + * @param parent + * new parent folder of the document. + */ + void addParent(Folder parent); - /** - * Remove this object from the children of parent - * - * @param parent - * parent folder of the document - */ - void removeParent(Folder parent); + /** + * Remove this object from the children of parent + * + * @param parent + * parent folder of the document + */ + void removeParent(Folder parent); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java Thu Apr 22 16:27:57 2010 @@ -33,80 +33,80 @@ import java.util.List; */ public interface ObjectStore { - /** - * Get the root folder of this object store - * - * @return the root folder of this store - */ - Folder getRootFolder(); - - /** - * return an object by path. - * - * @param path - * the path to the object - * @return the stored object with this path - */ - StoredObject getObjectByPath(String path); - - /** - * get an object by its id - * - * @param folderId - * the id of the object - * @return the object identified by this id - */ - StoredObject getObjectById(String folderId); - - /** - * Deletes an object from the store. For a folders the folder must be empty. - * - * @param objectId - */ - void deleteObject(String objectId); - - /** - * Create a document as initial step. The document is created but still - * temporary It is not yet persisted and does not have an id yet. After this - * call additional actions can take place (like assigning properties and a - * type) before it is persisted. - * - * @param name - * name of the document - * @return document object - */ - Document createDocument(String name); - - /** - * Create a folder as initial step. The folder is created but still - * temporary It is not yet persisted and does not have an id yet. After this - * call additional actions can take place (like assigning properties and a - * type) before it is persisted. - * - * @param name - * name of the folder - * @return folder object - */ - Folder createFolder(String name); - - /** - * Create a document that supports versions as initial step. The document is - * created but still temporary. It is not yet persisted and does not have an - * id yet. After this call additional actions can take place (like assigning - * properties and a type) before it is persisted. - * - * @param name - * name of the document - * @return versioned document object - */ - VersionedDocument createVersionedDocument(String name); - - /** - * Return a list of all documents that are checked out in the repository. - * - * @param orderBy - * orderBy specification according to CMIS spec. - * @return list of checked out documents in the repository - */ - List getCheckedOutDocuments(String orderBy); + /** + * Get the root folder of this object store + * + * @return the root folder of this store + */ + Folder getRootFolder(); + + /** + * return an object by path. + * + * @param path + * the path to the object + * @return the stored object with this path + */ + StoredObject getObjectByPath(String path); + + /** + * get an object by its id + * + * @param folderId + * the id of the object + * @return the object identified by this id + */ + StoredObject getObjectById(String folderId); + + /** + * Deletes an object from the store. For a folders the folder must be empty. + * + * @param objectId + */ + void deleteObject(String objectId); + + /** + * Create a document as initial step. The document is created but still + * temporary It is not yet persisted and does not have an id yet. After this + * call additional actions can take place (like assigning properties and a + * type) before it is persisted. + * + * @param name + * name of the document + * @return document object + */ + Document createDocument(String name); + + /** + * Create a folder as initial step. The folder is created but still + * temporary It is not yet persisted and does not have an id yet. After this + * call additional actions can take place (like assigning properties and a + * type) before it is persisted. + * + * @param name + * name of the folder + * @return folder object + */ + Folder createFolder(String name); + + /** + * Create a document that supports versions as initial step. The document is + * created but still temporary. It is not yet persisted and does not have an + * id yet. After this call additional actions can take place (like assigning + * properties and a type) before it is persisted. + * + * @param name + * name of the document + * @return versioned document object + */ + VersionedDocument createVersionedDocument(String name); + + /** + * Return a list of all documents that are checked out in the repository. + * + * @param orderBy + * orderBy specification according to CMIS spec. + * @return list of checked out documents in the repository + */ + List getCheckedOutDocuments(String orderBy); } \ No newline at end of file Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/SingleFiling.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/SingleFiling.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/SingleFiling.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/SingleFiling.java Thu Apr 22 16:27:57 2010 @@ -27,25 +27,25 @@ package org.apache.chemistry.opencmis.in */ public interface SingleFiling extends Filing { - /** - * @return - */ - String getPath(); + /** + * @return + */ + String getPath(); - /** - * @return - */ - Folder getParent(); + /** + * @return + */ + Folder getParent(); - /** - * Put the document in a folder and set the parent. This method should not - * be used to file a document in a folder. It is used internally when a - * document is filed to the folder. The document does not get persisted in - * this call. - * - * @param parent - * parent folder of the document to be assigned. - */ - void setParent(Folder parent); + /** + * Put the document in a folder and set the parent. This method should not + * be used to file a document in a folder. It is used internally when a + * document is filed to the folder. The document does not get persisted in + * this call. + * + * @param parent + * parent folder of the document to be assigned. + */ + void setParent(Folder parent); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java Thu Apr 22 16:27:57 2010 @@ -35,112 +35,112 @@ import org.apache.chemistry.opencmis.com */ public interface StoreManager { - /** - * return a list of all available repositories - * - * @return - */ - List getAllRepositoryIds(); - - /** - * Initialize the store for the given repository. Only called for - * repositories that exist on startup (i.e. for each repository id returned - * in a previous getAllRepositoryIds() call. - * - * @param repositoryId - * id of repository to initialize - * @param isCreated - * true if the repository was just created and is initialized for - * the first time false if it existed before and is reloaded - */ - public void initRepository(String repositoryId); - - /** - * get the object store for the given repository id. - * - * @param repositoryId - * @return the object store in which objects for this repository are stored. - */ - ObjectStore getObjectStore(String repositoryId); - - /** - * create a new repository with the given id. Create the repository, - * initiate the type system and initialize it so that it is ready for use - * - * @param repositoryId - * id of repository - * @param typeCreatorClassName - * class implementing the type creation, the class must implement - * the interface TypeCreator - */ - void createAndInitRepository(String repositoryId, String typeCreatorClassName); - - /** - * retrieve a list with all type definitions. - * - * @param repositoryId - * id of repository - * @param includePropertyDefinitions - * indicates whether to include property definitions in returned - * type - * @return map with type definition - */ - Collection getTypeDefinitionList(String repositoryId, boolean includePropertyDefinitions); - - /** - * Retrieve a type definition for a give repository and type id - * - * @param repositoryId - * id of repository - * @param typeId - * id of type definition - * @return type definition - */ - TypeDefinitionContainer getTypeById(String repositoryId, String typeId); - - /** - * Retrieve a type definition for a give repository and type id with or - * without property definitions and limited to depth in hierarchy - * - * @param repositoryId - * id of repository - * @param typeId - * id of type definition - * @param includePropertyDefinitions - * indicates whether to include property definitions in returned - * type - * @param depth - * limit depth of type hierarchy in return (-1 means unlimited) - * @return type definition - */ - TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean includePropertyDefinitions, - int depth); - - /** - * Retrieve a factory to create CMIS data structures used as containers - * - * @return factory object - */ - BindingsObjectFactory getObjectFactory(); - - /** - * Retrieve a list of root types in the repositories. Root types are - * available by definition and need to to be created by a client. CMIS - * supports documents, folders, relations and policies as root types - * - * @param repositoryId - * id of repository - * @return list of root types - */ - List getRootTypes(String repositoryId); - - /** - * Retrieve the repository information for a repository - * - * @param repositoryId - * id of repository - * @return repository information - */ - RepositoryInfo getRepositoryInfo(String repositoryId); + /** + * return a list of all available repositories + * + * @return + */ + List getAllRepositoryIds(); + + /** + * Initialize the store for the given repository. Only called for + * repositories that exist on startup (i.e. for each repository id returned + * in a previous getAllRepositoryIds() call. + * + * @param repositoryId + * id of repository to initialize + * @param isCreated + * true if the repository was just created and is initialized for + * the first time false if it existed before and is reloaded + */ + public void initRepository(String repositoryId); + + /** + * get the object store for the given repository id. + * + * @param repositoryId + * @return the object store in which objects for this repository are stored. + */ + ObjectStore getObjectStore(String repositoryId); + + /** + * create a new repository with the given id. Create the repository, + * initiate the type system and initialize it so that it is ready for use + * + * @param repositoryId + * id of repository + * @param typeCreatorClassName + * class implementing the type creation, the class must implement + * the interface TypeCreator + */ + void createAndInitRepository(String repositoryId, String typeCreatorClassName); + + /** + * retrieve a list with all type definitions. + * + * @param repositoryId + * id of repository + * @param includePropertyDefinitions + * indicates whether to include property definitions in returned + * type + * @return map with type definition + */ + Collection getTypeDefinitionList(String repositoryId, boolean includePropertyDefinitions); + + /** + * Retrieve a type definition for a give repository and type id + * + * @param repositoryId + * id of repository + * @param typeId + * id of type definition + * @return type definition + */ + TypeDefinitionContainer getTypeById(String repositoryId, String typeId); + + /** + * Retrieve a type definition for a give repository and type id with or + * without property definitions and limited to depth in hierarchy + * + * @param repositoryId + * id of repository + * @param typeId + * id of type definition + * @param includePropertyDefinitions + * indicates whether to include property definitions in returned + * type + * @param depth + * limit depth of type hierarchy in return (-1 means unlimited) + * @return type definition + */ + TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean includePropertyDefinitions, + int depth); + + /** + * Retrieve a factory to create CMIS data structures used as containers + * + * @return factory object + */ + BindingsObjectFactory getObjectFactory(); + + /** + * Retrieve a list of root types in the repositories. Root types are + * available by definition and need to to be created by a client. CMIS + * supports documents, folders, relations and policies as root types + * + * @param repositoryId + * id of repository + * @return list of root types + */ + List getRootTypes(String repositoryId); + + /** + * Retrieve the repository information for a repository + * + * @param repositoryId + * id of repository + * @return repository information + */ + RepositoryInfo getRepositoryInfo(String repositoryId); } \ No newline at end of file Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java Thu Apr 22 16:27:57 2010 @@ -36,195 +36,195 @@ import org.apache.chemistry.opencmis.com public interface StoredObject { - /** - * Retrieve the id of this object. - * - * @return id of this object - */ - String getId(); - - /** - * Retrieve the name of this object - * - * @return name of this object - */ - String getName(); - - /** - * Set the name of this document. This method does not persist the object. - * - * @param name - * name that is assigned to this object - */ - void setName(String name); - - /** - * Retrieve the type of this document. - * - * @return Id of the type identifying the type of this object - */ - String getTypeId(); - - /** - * Set the type of this document. This method does not persist the object. - * - * @param type - * id of the type this object gets assigned. - */ - void setTypeId(String type); - - /** - * Retrieve the user who created the document - * - * @return user who created the document. - */ - String getCreatedBy(); - - /** - * Set the user who last modified the object. This method does not persist - * the object. - * - * @param createdBy - * user who last modified the document - */ - void setCreatedBy(String createdBy); - - /** - * Retrieve the user who last modified the document - * - * @return user who last modified the document. - */ - String getModifiedBy(); - - /** - * Set the user who last modified the object. This method does not persist - * the object. - * - * @param modifiedBy - * user who last modified the document - */ - void setModifiedBy(String modifiedBy); - - GregorianCalendar getCreatedAt(); - - /** - * Assign date and time when the object was created. Usually you should not - * call this method externally. This method does not persist the object. - * - * @param createdAt - * date the object was created - */ - void setCreatedAt(GregorianCalendar createdAt); - - /** - * Retrieve date and time when the object was last modified. - * - * @return date the object was last modified - */ - GregorianCalendar getModifiedAt(); - - /** - * Assign current date and time when the object was last modified. Usually - * you should not call this method externally. This method does not persist - * the object. - */ - void setModifiedAtNow(); - - /** - * Get the repository id of this object where the object is stored. - * - * @return - */ - String getRepositoryId(); - - /** - * Assign a repository where this object will be stored. This method does - * not persist the object. - * - * @param repositoryId - * id of the repository - */ - void setRepositoryId(String repositoryId); - - /** - * Retrieve the list of properties - * - * @return - */ - Map> getProperties(); - - /** - * Assign the properties to an object. This method does not persist the - * object. - * - * @param props - * properties to be assigned - */ - void setProperties(Map> props); - - /** - * Retrieve a change token uniquely identifying the state of the object when - * it was persisted (used for optimistic locking) - * - * @return String identifying the change token - */ - String getChangeToken(); - - /** - * Persist the object so that it can be later retrieved by its id. Assign an - * id to the object - */ - void persist(); - - /** - * Rename an object - * - * @param newName - * the new name of the object - */ - void rename(String newName); - - /** - * Create all system base properties that need to be stored with every - * object in the repository This method is called when a new object is - * created to record all of the capturing data like the creation time, - * creator etc. - * - * @param properties - * The properties passed by the client, containing, name, type, - * etc - * @param user - * The user creating the document - */ - void createSystemBasePropertiesWhenCreated(Map> properties, String user); - - /** - * Update all system base properties that need to be stored with every - * object in the repository This method is called when an object is is - * updated to record all of the capturing data like the modification time, - * updating user etc. - * - * @param properties - * The properties passed by the client, containing, name, type, - * etc - * @param user - * The user creating the document - */ - void updateSystemBasePropertiesWhenModified(Map> properties, String user); - - void fillProperties(Map> properties, BindingsObjectFactory objFactory, - List requestedIds); - - /** - * Set all properties which are not system properties. These are the - * properties as defined in Type system definition. This method is called - * when an object is created or updated. The implementation must ignore the - * system properties. - * - * @param properties - * Set of properties as set by the client, including system - * parameters - */ - void setCustomProperties(Map> properties); + /** + * Retrieve the id of this object. + * + * @return id of this object + */ + String getId(); + + /** + * Retrieve the name of this object + * + * @return name of this object + */ + String getName(); + + /** + * Set the name of this document. This method does not persist the object. + * + * @param name + * name that is assigned to this object + */ + void setName(String name); + + /** + * Retrieve the type of this document. + * + * @return Id of the type identifying the type of this object + */ + String getTypeId(); + + /** + * Set the type of this document. This method does not persist the object. + * + * @param type + * id of the type this object gets assigned. + */ + void setTypeId(String type); + + /** + * Retrieve the user who created the document + * + * @return user who created the document. + */ + String getCreatedBy(); + + /** + * Set the user who last modified the object. This method does not persist + * the object. + * + * @param createdBy + * user who last modified the document + */ + void setCreatedBy(String createdBy); + + /** + * Retrieve the user who last modified the document + * + * @return user who last modified the document. + */ + String getModifiedBy(); + + /** + * Set the user who last modified the object. This method does not persist + * the object. + * + * @param modifiedBy + * user who last modified the document + */ + void setModifiedBy(String modifiedBy); + + GregorianCalendar getCreatedAt(); + + /** + * Assign date and time when the object was created. Usually you should not + * call this method externally. This method does not persist the object. + * + * @param createdAt + * date the object was created + */ + void setCreatedAt(GregorianCalendar createdAt); + + /** + * Retrieve date and time when the object was last modified. + * + * @return date the object was last modified + */ + GregorianCalendar getModifiedAt(); + + /** + * Assign current date and time when the object was last modified. Usually + * you should not call this method externally. This method does not persist + * the object. + */ + void setModifiedAtNow(); + + /** + * Get the repository id of this object where the object is stored. + * + * @return + */ + String getRepositoryId(); + + /** + * Assign a repository where this object will be stored. This method does + * not persist the object. + * + * @param repositoryId + * id of the repository + */ + void setRepositoryId(String repositoryId); + + /** + * Retrieve the list of properties + * + * @return + */ + Map> getProperties(); + + /** + * Assign the properties to an object. This method does not persist the + * object. + * + * @param props + * properties to be assigned + */ + void setProperties(Map> props); + + /** + * Retrieve a change token uniquely identifying the state of the object when + * it was persisted (used for optimistic locking) + * + * @return String identifying the change token + */ + String getChangeToken(); + + /** + * Persist the object so that it can be later retrieved by its id. Assign an + * id to the object + */ + void persist(); + + /** + * Rename an object + * + * @param newName + * the new name of the object + */ + void rename(String newName); + + /** + * Create all system base properties that need to be stored with every + * object in the repository This method is called when a new object is + * created to record all of the capturing data like the creation time, + * creator etc. + * + * @param properties + * The properties passed by the client, containing, name, type, + * etc + * @param user + * The user creating the document + */ + void createSystemBasePropertiesWhenCreated(Map> properties, String user); + + /** + * Update all system base properties that need to be stored with every + * object in the repository This method is called when an object is is + * updated to record all of the capturing data like the modification time, + * updating user etc. + * + * @param properties + * The properties passed by the client, containing, name, type, + * etc + * @param user + * The user creating the document + */ + void updateSystemBasePropertiesWhenModified(Map> properties, String user); + + void fillProperties(Map> properties, BindingsObjectFactory objFactory, + List requestedIds); + + /** + * Set all properties which are not system properties. These are the + * properties as defined in Type system definition. This method is called + * when an object is created or updated. The implementation must ignore the + * system properties. + * + * @param properties + * Set of properties as set by the client, including system + * parameters + */ + void setCustomProperties(Map> properties); } \ No newline at end of file Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Version.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Version.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Version.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Version.java Thu Apr 22 16:27:57 2010 @@ -27,20 +27,20 @@ package org.apache.chemistry.opencmis.in */ public interface Version { - boolean isMajor(); + boolean isMajor(); - boolean isPwc(); + boolean isPwc(); - /** - * make the private working copy an official version. - */ - void commit(boolean isMajor); + /** + * make the private working copy an official version. + */ + void commit(boolean isMajor); - void setCheckinComment(String comment); + void setCheckinComment(String comment); - String getCheckinComment(); + String getCheckinComment(); - String getVersionLabel(); + String getVersionLabel(); - VersionedDocument getParentDocument(); + VersionedDocument getParentDocument(); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/VersionedDocument.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/VersionedDocument.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/VersionedDocument.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/VersionedDocument.java Thu Apr 22 16:27:57 2010 @@ -34,33 +34,33 @@ import org.apache.chemistry.opencmis.com */ public interface VersionedDocument extends MultiFiling, StoredObject { - DocumentVersion addVersion(ContentStream content, VersioningState verState, String user); + DocumentVersion addVersion(ContentStream content, VersioningState verState, String user); - /** - * delete a version from this object, throw exception if document is checked - * out or document does not contain this version - * - * @param version - * version to be removed - * @return true if version could be removed, and other versions exist, false - * if the deleted version was the last version in this document - */ - boolean deleteVersion(DocumentVersion version); + /** + * delete a version from this object, throw exception if document is checked + * out or document does not contain this version + * + * @param version + * version to be removed + * @return true if version could be removed, and other versions exist, false + * if the deleted version was the last version in this document + */ + boolean deleteVersion(DocumentVersion version); - boolean isCheckedOut(); + boolean isCheckedOut(); - void cancelCheckOut(String user); + void cancelCheckOut(String user); - DocumentVersion checkOut(ContentStream content, String user); + DocumentVersion checkOut(ContentStream content, String user); - void checkIn(boolean isMajor, String checkinComment, String user); + void checkIn(boolean isMajor, String checkinComment, String user); - List getAllVersions(); + List getAllVersions(); - DocumentVersion getLatestVersion(boolean major); + DocumentVersion getLatestVersion(boolean major); - String getCheckedOutBy(); + String getCheckedOutBy(); - DocumentVersion getPwc(); + DocumentVersion getPwc(); } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java Thu Apr 22 16:27:57 2010 @@ -34,76 +34,76 @@ import org.apache.chemistry.opencmis.inm */ public abstract class AbstractMultiFilingImpl extends StoredObjectImpl implements MultiFiling { - protected List fParents = new ArrayList(1); + protected List fParents = new ArrayList(1); - AbstractMultiFilingImpl(ObjectStoreImpl objStore) { - super(objStore); - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.inmemory.storedobj.api.MultiParentPath#addParent( - * org.apache.opencmis.inmemory.storedobj.api.Folder) - */ - public void addParent(Folder parent) { - - if (parent.hasChild(getName())) - throw new IllegalArgumentException( - "Cannot assign new parent folder, this name already exists in target folder."); - - if (null == fParents) - fParents = new ArrayList(); - - fParents.add(parent); - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.inmemory.storedobj.api.MultiParentPath#removeParent - * (org.apache.opencmis.inmemory.storedobj.api.Folder) - */ - public void removeParent(Folder parent) { - fParents.remove(parent); - if (fParents.isEmpty()) - fParents = null; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.inmemory.storedobj.api.MultiParentPath#getParents() - */ - public List getParents() { - return fParents; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.inmemory.storedobj.api.MultiParentPath#getPathSegment - * () - */ - public String getPathSegment() { - return getName(); - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.opencmis.inmemory.storedobj.api.Path#move(org.apache.opencmis - * .inmemory.storedobj.api.Folder, - * org.apache.opencmis.inmemory.storedobj.api.Folder) - */ - public void move(Folder oldParent, Folder newParent) { - addParent(newParent); - removeParent(oldParent); - } + AbstractMultiFilingImpl(ObjectStoreImpl objStore) { + super(objStore); + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.opencmis.inmemory.storedobj.api.MultiParentPath#addParent( + * org.apache.opencmis.inmemory.storedobj.api.Folder) + */ + public void addParent(Folder parent) { + + if (parent.hasChild(getName())) + throw new IllegalArgumentException( + "Cannot assign new parent folder, this name already exists in target folder."); + + if (null == fParents) + fParents = new ArrayList(); + + fParents.add(parent); + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.opencmis.inmemory.storedobj.api.MultiParentPath#removeParent + * (org.apache.opencmis.inmemory.storedobj.api.Folder) + */ + public void removeParent(Folder parent) { + fParents.remove(parent); + if (fParents.isEmpty()) + fParents = null; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.opencmis.inmemory.storedobj.api.MultiParentPath#getParents() + */ + public List getParents() { + return fParents; + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.opencmis.inmemory.storedobj.api.MultiParentPath#getPathSegment + * () + */ + public String getPathSegment() { + return getName(); + } + + /* + * (non-Javadoc) + * + * @see + * org.apache.opencmis.inmemory.storedobj.api.Path#move(org.apache.opencmis + * .inmemory.storedobj.api.Folder, + * org.apache.opencmis.inmemory.storedobj.api.Folder) + */ + public void move(Folder oldParent, Folder newParent) { + addParent(newParent); + removeParent(oldParent); + } } Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java Thu Apr 22 16:27:57 2010 @@ -40,93 +40,93 @@ import org.apache.chemistry.opencmis.inm public abstract class AbstractSingleFilingImpl extends StoredObjectImpl implements SingleFiling { - protected FolderImpl fParent; + protected FolderImpl fParent; - protected AbstractSingleFilingImpl(ObjectStoreImpl objStore) { - super(objStore); - } - - /* - * (non-Javadoc) - * - * @see - * org.opencmis.client.provider.spi.inmemory.StoredObjectWithPath#getPath() - */ - public String getPath() { - StringBuffer path = new StringBuffer(getName()); - if (null == getParent()) - path.replace(0, path.length(), PATH_SEPARATOR); // root folder--> - // set / - else { - Folder f = getParent(); - while (f.getParent() != null) { - path.insert(0, PATH_SEPARATOR); - path.insert(0, f.getName()); - f = f.getParent(); - } - path.insert(0, PATH_SEPARATOR); - } - // if (LOG.isDebugEnabled()) - // LOG.debug("getPath() returns: " + path.toString()); - return path.toString(); - } - - /* - * (non-Javadoc) - * - * @see - * org.opencmis.client.provider.spi.inmemory.StoredObjectWithPath#getParent - * () - */ - public Folder getParent() { - return fParent; - } - - public List getParents() { - if (null == fParent) - return Collections.emptyList(); - else - return Collections.singletonList((Folder) fParent); - } - - /* - * (non-Javadoc) - * - * @see - * org.opencmis.client.provider.spi.inmemory.storedobj.api.StoredObjectWithPath - * # - * setParent(org.opencmis.client.provider.spi.inmemory.storedobj.api.Folder) - */ - public void setParent(Folder parent) { - fParent = (FolderImpl) parent; - } - - public void rename(String newName) { - if (!NameValidator.isValidId(newName)) - throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME); - if (getParent() == null) - throw new CmisInvalidArgumentException("Root folder cannot be renamed."); - if (getParent().hasChild(newName)) - throw new CmisNameConstraintViolationException("Cannot rename object to " + newName - + ". This path already exists."); - - setName(newName); - } - - public void move(Folder oldParent, Folder newParent) { - - if (this instanceof Document || this instanceof VersionedDocument) - fParent.moveChildDocument(this, oldParent, newParent); - else {// it must be a folder - if (getParent() == null) - throw new IllegalArgumentException("Root folder cannot be moved."); - if (newParent == null) - throw new IllegalArgumentException("null is not a valid move target."); - if (newParent.hasChild(getName())) - throw new IllegalArgumentException("Cannot move folder, this name already exists in target."); - - setParent(newParent); - } - } + protected AbstractSingleFilingImpl(ObjectStoreImpl objStore) { + super(objStore); + } + + /* + * (non-Javadoc) + * + * @see + * org.opencmis.client.provider.spi.inmemory.StoredObjectWithPath#getPath() + */ + public String getPath() { + StringBuffer path = new StringBuffer(getName()); + if (null == getParent()) + path.replace(0, path.length(), PATH_SEPARATOR); // root folder--> + // set / + else { + Folder f = getParent(); + while (f.getParent() != null) { + path.insert(0, PATH_SEPARATOR); + path.insert(0, f.getName()); + f = f.getParent(); + } + path.insert(0, PATH_SEPARATOR); + } + // if (LOG.isDebugEnabled()) + // LOG.debug("getPath() returns: " + path.toString()); + return path.toString(); + } + + /* + * (non-Javadoc) + * + * @see + * org.opencmis.client.provider.spi.inmemory.StoredObjectWithPath#getParent + * () + */ + public Folder getParent() { + return fParent; + } + + public List getParents() { + if (null == fParent) + return Collections.emptyList(); + else + return Collections.singletonList((Folder) fParent); + } + + /* + * (non-Javadoc) + * + * @see + * org.opencmis.client.provider.spi.inmemory.storedobj.api.StoredObjectWithPath + * # + * setParent(org.opencmis.client.provider.spi.inmemory.storedobj.api.Folder) + */ + public void setParent(Folder parent) { + fParent = (FolderImpl) parent; + } + + public void rename(String newName) { + if (!NameValidator.isValidId(newName)) + throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME); + if (getParent() == null) + throw new CmisInvalidArgumentException("Root folder cannot be renamed."); + if (getParent().hasChild(newName)) + throw new CmisNameConstraintViolationException("Cannot rename object to " + newName + + ". This path already exists."); + + setName(newName); + } + + public void move(Folder oldParent, Folder newParent) { + + if (this instanceof Document || this instanceof VersionedDocument) + fParent.moveChildDocument(this, oldParent, newParent); + else {// it must be a folder + if (getParent() == null) + throw new IllegalArgumentException("Root folder cannot be moved."); + if (newParent == null) + throw new IllegalArgumentException("null is not a valid move target."); + if (newParent.hasChild(getName())) + throw new IllegalArgumentException("Cannot move folder, this name already exists in target."); + + setParent(newParent); + } + } } Modified: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java Thu Apr 22 16:27:57 2010 @@ -11,91 +11,91 @@ import org.apache.chemistry.opencmis.com public class ContentStreamDataImpl implements ContentStream { - private int fLength; + private int fLength; - private String fMimeType; + private String fMimeType; - private String fFileName; + private String fFileName; - private byte[] fContent; + private byte[] fContent; - private long fStreamLimitOffset; - - private long fStreamLimitLength; - - public void setContent(InputStream in) throws IOException { - fStreamLimitOffset = 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;) { - contentStream.write(buffer, 0, len); - fLength += len; - } - fContent = contentStream.toByteArray(); - fLength = contentStream.size(); - contentStream.close(); - in.close(); - } - } - - public long getLength() { - return fLength; - } - - public BigInteger getBigLength() { - return BigInteger.valueOf(fLength); - } - - public String getMimeType() { - return fMimeType; - } - - public void setMimeType(String fMimeType) { - this.fMimeType = fMimeType; - } - - public String getFileName() { - return fFileName; - } - - public void setFileName(String fileName) { - this.fFileName = fileName; - } - - public String getFilename() { - return fFileName; - } - - public InputStream getStream() { - if (null == fContent) - return null; - else if (fStreamLimitOffset <= 0 && fStreamLimitLength < 0) - return new ByteArrayInputStream(fContent); - else - return new ByteArrayInputStream(fContent, (int) (fStreamLimitOffset < 0 ? 0 : fStreamLimitOffset), - (int) (fStreamLimitLength < 0 ? fLength : fStreamLimitLength)); - } - - public ContentStream getCloneWithLimits(long offset, long length) { - ContentStreamDataImpl clone = new ContentStreamDataImpl(); - clone.fFileName = fFileName; - clone.fLength = fLength; - clone.fContent = fContent; - clone.fMimeType = fMimeType; - clone.fStreamLimitOffset = offset; - clone.fStreamLimitLength = length; - return clone; - } - - public List getExtensions() { - return null; - } - - public void setExtensions(List extensions) { - // not implemented - } + private long fStreamLimitOffset; + + private long fStreamLimitLength; + + public void setContent(InputStream in) throws IOException { + fStreamLimitOffset = 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;) { + contentStream.write(buffer, 0, len); + fLength += len; + } + fContent = contentStream.toByteArray(); + fLength = contentStream.size(); + contentStream.close(); + in.close(); + } + } + + public long getLength() { + return fLength; + } + + public BigInteger getBigLength() { + return BigInteger.valueOf(fLength); + } + + public String getMimeType() { + return fMimeType; + } + + public void setMimeType(String fMimeType) { + this.fMimeType = fMimeType; + } + + public String getFileName() { + return fFileName; + } + + public void setFileName(String fileName) { + this.fFileName = fileName; + } + + public String getFilename() { + return fFileName; + } + + public InputStream getStream() { + if (null == fContent) + return null; + else if (fStreamLimitOffset <= 0 && fStreamLimitLength < 0) + return new ByteArrayInputStream(fContent); + else + return new ByteArrayInputStream(fContent, (int) (fStreamLimitOffset < 0 ? 0 : fStreamLimitOffset), + (int) (fStreamLimitLength < 0 ? fLength : fStreamLimitLength)); + } + + public ContentStream getCloneWithLimits(long offset, long length) { + ContentStreamDataImpl clone = new ContentStreamDataImpl(); + clone.fFileName = fFileName; + clone.fLength = fLength; + clone.fContent = fContent; + clone.fMimeType = fMimeType; + clone.fStreamLimitOffset = offset; + clone.fStreamLimitLength = length; + return clone; + } + + public List getExtensions() { + return null; + } + + public void setExtensions(List extensions) { + // not implemented + } } Modified: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java?rev=936938&r1=936937&r2=936938&view=diff ============================================================================== --- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java (original) +++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java Thu Apr 22 16:27:57 2010 @@ -40,86 +40,86 @@ import org.apache.commons.logging.LogFac */ public class DocumentImpl extends AbstractMultiFilingImpl implements Document { - private ContentStreamDataImpl fContent; + private ContentStreamDataImpl fContent; - private static final Log LOG = LogFactory.getLog(AbstractSingleFilingImpl.class.getName()); + private static final Log LOG = LogFactory.getLog(AbstractSingleFilingImpl.class.getName()); - DocumentImpl(ObjectStoreImpl objStore) { // visibility should be package - super(objStore); - } - - /* - * (non-Javadoc) - * - * @see org.opencmis.client.provider.spi.inmemory.IDocument#getContent() - */ - public ContentStream getContent(long offset, long length) { - if (null == fContent) - return null; - else if (offset <= 0 && length < 0) - return fContent; - else - return fContent.getCloneWithLimits(offset, length); - } - - /* - * (non-Javadoc) - * - * @see - * org.opencmis.client.provider.spi.inmemory.IDocument#setContent(org.opencmis - * .client.provider .ContentStreamData) - */ - public void setContent(ContentStream content, boolean mustPersist) { - - if (null == content) { - fContent = null; - } else { - fContent = new ContentStreamDataImpl(); - fContent.setFileName(content.getFileName()); - fContent.setMimeType(content.getMimeType()); - try { - fContent.setContent(content.getStream()); - } catch (IOException e) { - e.printStackTrace(); - throw new RuntimeException("Failed to get content from InputStream", e); - } - } - } - - public void fillProperties(Map> properties, BindingsObjectFactory objFactory, - List requestedIds) { - - super.fillProperties(properties, objFactory, requestedIds); - - // fill the version related properties (versions should override this - // but the spec requires some - // properties always to be set - - if (FilterParser.isContainedInFilter(PropertyIds.IS_IMMUTABLE, requestedIds)) { - properties.put(PropertyIds.IS_IMMUTABLE, objFactory.createPropertyBooleanData(PropertyIds.IS_IMMUTABLE, - false)); - } - - // Set the content related properties - if (null != fContent) { - if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_FILE_NAME, requestedIds)) { - properties.put(PropertyIds.CONTENT_STREAM_FILE_NAME, objFactory.createPropertyStringData( - PropertyIds.CONTENT_STREAM_FILE_NAME, fContent.getFileName())); - } - // omit: PropertyIds.CMIS_CONTENT_STREAM_ID - if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_LENGTH, requestedIds)) { - properties.put(PropertyIds.CONTENT_STREAM_LENGTH, objFactory.createPropertyIntegerData( - PropertyIds.CONTENT_STREAM_LENGTH, fContent.getBigLength())); - } - if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_MIME_TYPE, requestedIds)) { - properties.put(PropertyIds.CONTENT_STREAM_MIME_TYPE, objFactory.createPropertyStringData( - PropertyIds.CONTENT_STREAM_MIME_TYPE, fContent.getMimeType())); - } - } - } - - public boolean hasContent() { - return null != fContent; - } + DocumentImpl(ObjectStoreImpl objStore) { // visibility should be package + super(objStore); + } + + /* + * (non-Javadoc) + * + * @see org.opencmis.client.provider.spi.inmemory.IDocument#getContent() + */ + public ContentStream getContent(long offset, long length) { + if (null == fContent) + return null; + else if (offset <= 0 && length < 0) + return fContent; + else + return fContent.getCloneWithLimits(offset, length); + } + + /* + * (non-Javadoc) + * + * @see + * org.opencmis.client.provider.spi.inmemory.IDocument#setContent(org.opencmis + * .client.provider .ContentStreamData) + */ + public void setContent(ContentStream content, boolean mustPersist) { + + if (null == content) { + fContent = null; + } else { + fContent = new ContentStreamDataImpl(); + fContent.setFileName(content.getFileName()); + fContent.setMimeType(content.getMimeType()); + try { + fContent.setContent(content.getStream()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("Failed to get content from InputStream", e); + } + } + } + + public void fillProperties(Map> properties, BindingsObjectFactory objFactory, + List requestedIds) { + + super.fillProperties(properties, objFactory, requestedIds); + + // fill the version related properties (versions should override this + // but the spec requires some + // properties always to be set + + if (FilterParser.isContainedInFilter(PropertyIds.IS_IMMUTABLE, requestedIds)) { + properties.put(PropertyIds.IS_IMMUTABLE, objFactory.createPropertyBooleanData(PropertyIds.IS_IMMUTABLE, + false)); + } + + // Set the content related properties + if (null != fContent) { + if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_FILE_NAME, requestedIds)) { + properties.put(PropertyIds.CONTENT_STREAM_FILE_NAME, objFactory.createPropertyStringData( + PropertyIds.CONTENT_STREAM_FILE_NAME, fContent.getFileName())); + } + // omit: PropertyIds.CMIS_CONTENT_STREAM_ID + if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_LENGTH, requestedIds)) { + properties.put(PropertyIds.CONTENT_STREAM_LENGTH, objFactory.createPropertyIntegerData( + PropertyIds.CONTENT_STREAM_LENGTH, fContent.getBigLength())); + } + if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_MIME_TYPE, requestedIds)) { + properties.put(PropertyIds.CONTENT_STREAM_MIME_TYPE, objFactory.createPropertyStringData( + PropertyIds.CONTENT_STREAM_MIME_TYPE, fContent.getMimeType())); + } + } + } + + public boolean hasContent() { + return null != fContent; + } }