Merge from SEAMIST3

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10725 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2008-09-04 10:55:16 +00:00
parent 703d1a3564
commit e22df58ebb
55 changed files with 3895 additions and 6518 deletions

View File

@@ -24,7 +24,7 @@
*/
package org.alfresco.repo.cmis.rest;
import org.alfresco.repo.cmis.rest.Navigation.TypesFilter;
import org.alfresco.repo.cmis.rest.CMISService.TypesFilter;
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
import org.alfresco.repo.jscript.ScriptNode;
import org.alfresco.repo.web.scripts.Repository;
@@ -45,12 +45,12 @@ public class CMISScript extends BaseScopableProcessorExtension
{
private static final TypesFilter defaultTypesFilter = TypesFilter.FoldersAndDocuments;
private ServiceRegistry services;
private Repository repository;
private Navigation navigation;
private CMISService cmisService;
private Paging paging;
/**
* Set the service registry
*
@@ -84,13 +84,32 @@ public class CMISScript extends BaseScopableProcessorExtension
/**
* Set the CMIS Navigation helper
*
* @param navigation
* @param cmisService
*/
public void setNavigation(Navigation navigation)
public void setCMISService(CMISService cmisService)
{
this.navigation = navigation;
this.cmisService = cmisService;
}
/**
* Gets the default root folder path
*
* @return default root folder path
*/
public String getDefaultRootFolderPath()
{
return cmisService.getDefaultRootPath();
}
/**
* Gets the default root folder
*
* @return default root folder
*/
public ScriptNode getDefaultRootFolder()
{
return new ScriptNode(cmisService.getDefaultRootNodeRef(), services, getScope());
}
/**
* Finds the arg value from the specified url argument and header
@@ -182,7 +201,7 @@ public class CMISScript extends BaseScopableProcessorExtension
public PagedResults queryChildren(ScriptNode parent, String typesFilter, Page page)
{
TypesFilter filter = resolveTypesFilter(typesFilter);
NodeRef[] children = navigation.getChildren(parent.getNodeRef(), filter);
NodeRef[] children = cmisService.getChildren(parent.getNodeRef(), filter);
Cursor cursor = paging.createCursor(children.length, page);
ScriptNode[] nodes = new ScriptNode[cursor.getRowCount()];
@@ -194,6 +213,54 @@ public class CMISScript extends BaseScopableProcessorExtension
PagedResults results = paging.createPagedResults(nodes, cursor);
return results;
}
/**
* Query for items checked-out to user
*
* @param username user
* @param page
* @return paged result set of checked-out items
*/
public PagedResults queryCheckedOut(String username, Page page)
{
return queryCheckedOut(username, null, false, page);
}
/**
* Query for items checked-out to user within folder
*
* @param username user
* @param folder folder
* @param page
* @return paged result set of checked-out items
*/
public PagedResults queryCheckedOut(String username, ScriptNode folder, Page page)
{
return queryCheckedOut(username, folder, false, page);
}
/**
* Query for items checked-out to user within folder (and possibly descendants)
*
* @param username user
* @param folder folder
* @param includeDescendants true = include descendants
* @param page
* @return paged result set of checked-out items
*/
public PagedResults queryCheckedOut(String username, ScriptNode folder, boolean includeDescendants, Page page)
{
NodeRef[] checkedout = cmisService.getCheckedOut(username, (folder == null) ? null : folder.getNodeRef(), includeDescendants);
Cursor cursor = paging.createCursor(checkedout.length, page);
ScriptNode[] nodes = new ScriptNode[cursor.getRowCount()];
for (int i = cursor.getStartRow(); i <= cursor.getEndRow(); i++)
{
nodes[i - cursor.getStartRow()] = new ScriptNode(checkedout[i], services, getScope());
}
PagedResults results = paging.createPagedResults(nodes, cursor);
return results;
}
/**
* Resolve to a Types Filter

View File

@@ -0,0 +1,437 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.cmis.rest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.QueryParameterDefImpl;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.tenant.TenantDeployer;
import org.alfresco.repo.tenant.TenantDeployerService;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.repo.web.scripts.Repository;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.QueryParameterDefinition;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.AbstractLifecycleBean;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
/**
* CMIS Navigation Service
*
* @author davidc
*/
public class CMISService implements ApplicationContextAware, ApplicationListener, TenantDeployer
{
/**
* Types Filter
*
* @author davidc
*/
public enum TypesFilter
{
Folders,
FoldersAndDocuments,
Documents
};
/** Query Parameters */
private static final QName PARAM_PARENT = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "parent");
private static final QName PARAM_USERNAME = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "username");
/** Shallow search for all files and folders */
private static final String LUCENE_QUERY_SHALLOW_FOLDERS =
"+PARENT:\"${cm:parent}\" " +
"-TYPE:\"" + ContentModel.TYPE_SYSTEM_FOLDER + "\" " +
"+TYPE:\"" + ContentModel.TYPE_FOLDER + "\" ";
/** Shallow search for all files and folders */
private static final String LUCENE_QUERY_SHALLOW_FILES =
"+PARENT:\"${cm:parent}\" " +
"-TYPE:\"" + ContentModel.TYPE_SYSTEM_FOLDER + "\" " +
"+TYPE:\"" + ContentModel.TYPE_CONTENT + "\" ";
private static final String LUCENE_QUERY_CHECKEDOUT =
"+@cm\\:workingCopyOwner:${cm:username}";
private static final String LUCENE_QUERY_CHECKEDOUT_IN_FOLDER =
"+@cm\\:workingCopyOwner:${cm:username} " +
"+PARENT:\"${cm:parent}\"";
// dependencies
private Repository repository;
private RetryingTransactionHelper retryingTransactionHelper;
private DictionaryService dictionaryService;
private SearchService searchService;
private NodeService nodeService;
private TenantDeployerService tenantDeployerService;
private ProcessorLifecycle lifecycle = new ProcessorLifecycle();
// default CMIS store and path
private String defaultRootPath;
private Map<String, NodeRef> defaultRootNodeRefs;
// data types for query
private DataTypeDefinition nodeRefDataType;
private DataTypeDefinition textDataType;
/**
* Sets the default root path
*
* store_type/store_id/path...
*
* @param path store_type/store_id/path...
*/
public void setDefaultRootPath(String path)
{
defaultRootPath = path;
}
/**
* Sets the tenant deployer service
*
* @param tenantDeployerService
*/
public void setTenantDeployerService(TenantDeployerService tenantDeployerService)
{
this.tenantDeployerService = tenantDeployerService;
}
/**
* Sets helper that provides transaction callbacks
*/
public void setTransactionHelper(RetryingTransactionHelper retryingTransactionHelper)
{
this.retryingTransactionHelper = retryingTransactionHelper;
}
/**
* @param dictionaryService
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* @param searchService
*/
public void setSearchService(SearchService searchService)
{
this.searchService = searchService;
}
/**
* @param nodeService
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @param repository
*/
public void setRepository(Repository repository)
{
this.repository = repository;
}
/* (non-Javadoc)
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
lifecycle.setApplicationContext(applicationContext);
}
/* (non-Javadoc)
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
*/
public void onApplicationEvent(ApplicationEvent event)
{
lifecycle.onApplicationEvent(event);
}
/**
* Hooks into Spring Application Lifecycle
*/
private class ProcessorLifecycle extends AbstractLifecycleBean
{
@Override
protected void onBootstrap(ApplicationEvent event)
{
init();
}
@Override
protected void onShutdown(ApplicationEvent event)
{
}
}
/* (non-Javadoc)
* @see org.alfresco.repo.tenant.TenantDeployer#onEnableTenant()
*/
public void onEnableTenant()
{
init();
}
/* (non-Javadoc)
* @see org.alfresco.repo.tenant.TenantDeployer#onDisableTenant()
*/
public void onDisableTenant()
{
destroy();
}
/* (non-Javadoc)
* @see org.alfresco.repo.tenant.TenantDeployer#init()
*/
public void init()
{
// initialise data types
nodeRefDataType = dictionaryService.getDataType(DataTypeDefinition.NODE_REF);
textDataType = dictionaryService.getDataType(DataTypeDefinition.TEXT);
// initialise root node ref
tenantDeployerService.register(this);
if (defaultRootNodeRefs == null)
{
defaultRootNodeRefs = new HashMap<String, NodeRef>(1);
}
getDefaultRootNodeRef();
}
/* (non-Javadoc)
* @see org.alfresco.repo.tenant.TenantDeployer#destroy()
*/
public void destroy()
{
defaultRootNodeRefs.remove(tenantDeployerService.getCurrentUserDomain());
}
/**
* Gets the default root node path
*
* @return root node path
*/
public String getDefaultRootPath()
{
return defaultRootPath;
}
/**
* Gets the default root node ref
*
* @return root node ref
*/
public NodeRef getDefaultRootNodeRef()
{
String tenantDomain = tenantDeployerService.getCurrentUserDomain();
NodeRef defaultNodeRef = defaultRootNodeRefs.get(tenantDomain);
if (defaultNodeRef == null)
{
defaultNodeRef = AuthenticationUtil.runAs(new RunAsWork<NodeRef>()
{
public NodeRef doWork() throws Exception
{
return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>()
{
public NodeRef execute() throws Exception
{
return repository.findNodeRef("path", defaultRootPath.split("/"));
};
});
}
}, AuthenticationUtil.getSystemUserName());
if (defaultNodeRef == null)
{
throw new AlfrescoRuntimeException("Default root folder path '" + defaultRootPath + "' not found");
}
defaultRootNodeRefs.put(tenantDomain, defaultNodeRef);
}
return defaultNodeRef;
}
/**
* Gets the default store ref
*
* @return store ref
*/
public StoreRef getDefaultRootStoreRef()
{
return getDefaultRootNodeRef().getStoreRef();
}
/**
* Query for node children
*
* @param parent node to query children for
* @param typesFilter types filter
* @return children of node
*/
public NodeRef[] getChildren(NodeRef parent, TypesFilter typesFilter)
{
if (typesFilter == TypesFilter.FoldersAndDocuments)
{
NodeRef[] folders = queryChildren(parent, TypesFilter.Folders);
NodeRef[] docs = queryChildren(parent, TypesFilter.Documents);
NodeRef[] foldersAndDocs = new NodeRef[folders.length + docs.length];
System.arraycopy(folders, 0, foldersAndDocs, 0, folders.length);
System.arraycopy(docs, 0, foldersAndDocs, folders.length, docs.length);
return foldersAndDocs;
}
else if (typesFilter == TypesFilter.Folders)
{
NodeRef[] folders = queryChildren(parent, TypesFilter.Folders);
return folders;
}
else if (typesFilter == TypesFilter.Documents)
{
NodeRef[] docs = queryChildren(parent, TypesFilter.Documents);
return docs;
}
return new NodeRef[0];
}
/**
* Query for checked out items
*
* @param username for user
* @param folder (optional) within folder
* @param includeDescendants true => include descendants of folder, false => only children of folder
* @return checked out items
*/
public NodeRef[] getCheckedOut(String username, NodeRef folder, boolean includeDescendants)
{
SearchParameters params = new SearchParameters();
params.setLanguage(SearchService.LANGUAGE_LUCENE);
QueryParameterDefinition usernameDef = new QueryParameterDefImpl(PARAM_USERNAME, textDataType, true, username);
params.addQueryParameterDefinition(usernameDef);
if (folder == null)
{
// get all checked-out items
params.setQuery(LUCENE_QUERY_CHECKEDOUT);
params.addStore(getDefaultRootStoreRef());
}
else
{
// get all checked-out items within folder
// NOTE: special-case for all descendants in root folder (treat as all checked-out items)
if (includeDescendants && nodeService.getRootNode(folder.getStoreRef()) == folder)
{
// get all checked-out items within specified folder store
params.setQuery(LUCENE_QUERY_CHECKEDOUT);
params.addStore(folder.getStoreRef());
}
else
{
// TODO: implement descendants of folder
params.setQuery(LUCENE_QUERY_CHECKEDOUT_IN_FOLDER);
params.addStore(folder.getStoreRef());
QueryParameterDefinition parentDef = new QueryParameterDefImpl(PARAM_PARENT, nodeRefDataType, true, folder.toString());
params.addQueryParameterDefinition(parentDef);
}
}
ResultSet resultSet = searchService.query(params);
try
{
List<NodeRef> results = resultSet.getNodeRefs();
NodeRef[] nodeRefs = new NodeRef[results.size()];
return results.toArray(nodeRefs);
}
finally
{
resultSet.close();
}
}
/**
* Query children helper
*
* NOTE: Queries for folders only or documents only
*
* @param parent node to query children for
* @param typesFilter folders or documents
* @return node children
*/
private NodeRef[] queryChildren(NodeRef parent, TypesFilter typesFilter)
{
SearchParameters params = new SearchParameters();
params.setLanguage(SearchService.LANGUAGE_LUCENE);
params.addStore(parent.getStoreRef());
QueryParameterDefinition parentDef = new QueryParameterDefImpl(PARAM_PARENT, nodeRefDataType, true, parent.toString());
params.addQueryParameterDefinition(parentDef);
if (typesFilter == TypesFilter.Folders)
{
params.setQuery(LUCENE_QUERY_SHALLOW_FOLDERS);
}
else if (typesFilter == TypesFilter.Documents)
{
params.setQuery(LUCENE_QUERY_SHALLOW_FILES);
}
ResultSet resultSet = searchService.query(params);
try
{
List<NodeRef> results = resultSet.getNodeRefs();
NodeRef[] nodeRefs = new NodeRef[results.size()];
return results.toArray(nodeRefs);
}
finally
{
resultSet.close();
}
}
}

View File

@@ -25,21 +25,17 @@
package org.alfresco.repo.cmis.rest;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.alfresco.repo.cmis.rest.xsd.CMISValidator;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.springframework.core.io.ClassPathResource;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -52,71 +48,19 @@ import org.xml.sax.SAXException;
*/
public class CMISWebScriptTest extends BaseWebScriptTest
{
/** XML Schema Validation */
private static DocumentBuilder documentBuilder = null;
private static Validator appValidator = null;
private static Validator atomValidator = null;
/**
* Gets document parser
*
* @return document parser
* @throws ParserConfigurationException
*/
protected static DocumentBuilder getDocumentBuilder()
throws ParserConfigurationException
{
if (documentBuilder == null)
{
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(true);
documentBuilder = builderFactory.newDocumentBuilder();
}
return documentBuilder;
}
/**
* Gets CMIS Atom Publishing Protocol XML Validator
*
* @return APP Validator
* @throws IOException
* @throws SAXException
*/
protected static Validator getAppValidator()
throws IOException, SAXException
{
if (appValidator == null)
{
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaFile = new StreamSource(new ClassPathResource("org/alfresco/repo/cmis/rest/xsd/APP.xsd").getFile());
Schema schema = factory.newSchema(schemaFile);
appValidator = schema.newValidator();
}
return appValidator;
}
/**
* Gets CMIS Atom Validator
*
* @return CMIS Atom Validator
* @throws IOException
* @throws SAXException
*/
protected static Validator getCMISAtomValidator()
throws IOException, SAXException
{
if (atomValidator == null)
{
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaFile = new StreamSource(new ClassPathResource("org/alfresco/repo/cmis/rest/xsd/ATOM4CMIS.xsd").getFile());
Schema schema = factory.newSchema(schemaFile);
atomValidator = schema.newValidator();
}
return atomValidator;
}
private CMISValidator cmisValidator = new CMISValidator();
/**
* Gets CMIS Validator
*
* @return CMIS Validator
*/
protected CMISValidator getCMISValidator()
{
return cmisValidator;
}
/**
* Asserts XML complies with specified Validator
*
@@ -125,34 +69,56 @@ public class CMISWebScriptTest extends BaseWebScriptTest
* @throws IOException
* @throws ParserConfigurationException
*/
public void assertValidXML(String xml, Validator validator)
protected void assertValidXML(String xml, Validator validator)
throws IOException, ParserConfigurationException
{
try
{
Document document = getDocumentBuilder().parse(new InputSource(new StringReader(xml)));
Document document = cmisValidator.getDocumentBuilder().parse(new InputSource(new StringReader(xml)));
validator.validate(new DOMSource(document));
}
catch (SAXException e)
{
fail(e.toString() + "\n\n" + xml);
fail(cmisValidator.toString(e, xml));
}
}
}
/**
public static void main(String[] args) throws IOException, ParserConfigurationException
* Load text from file specified by class path
*
* @param classPath XML file
* @return XML
* @throws IOException
*/
protected String loadString(String classPath)
throws IOException
{
InputStream input = getClass().getResourceAsStream(classPath);
if (input == null)
{
throw new IOException(classPath + " not found.");
}
InputStreamReader reader = new InputStreamReader(input);
StringWriter writer = new StringWriter();
try
{
Document document = getDocumentBuilder().parse(new ClassPathResource("test.xml").getFile());
getAppValidator().validate(new DOMSource(document));
char[] buffer = new char[4096];
int bytesRead = -1;
while ((bytesRead = reader.read(buffer)) != -1)
{
writer.write(buffer, 0, bytesRead);
}
writer.flush();
}
catch (SAXException e)
finally
{
fail(e.toString());
reader.close();
writer.close();
}
return writer.toString();
}
*/
}

View File

@@ -1,179 +0,0 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.cmis.rest;
import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.QueryParameterDefImpl;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.QueryParameterDefinition;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.springframework.beans.factory.InitializingBean;
/**
* CMIS Navigation Service
*
* @author davidc
*/
public class Navigation implements InitializingBean
{
/**
* Types Filter
*
* @author davidc
*/
public enum TypesFilter
{
Folders,
FoldersAndDocuments,
Documents
};
/** Query Parameters */
private static final QName PARAM_PARENT = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "parent");
/** Shallow search for all files and folders */
private static final String LUCENE_QUERY_SHALLOW_FOLDERS =
"+PARENT:\"${cm:parent}\" " +
"-TYPE:\"" + ContentModel.TYPE_SYSTEM_FOLDER + "\" " +
"+TYPE:\"" + ContentModel.TYPE_FOLDER + "\" ";
/** Shallow search for all files and folders */
private static final String LUCENE_QUERY_SHALLOW_FILES =
"+PARENT:\"${cm:parent}\" " +
"-TYPE:\"" + ContentModel.TYPE_SYSTEM_FOLDER + "\" " +
"+TYPE:\"" + ContentModel.TYPE_CONTENT + "\" ";
// dependencies
private DictionaryService dictionaryService;
private SearchService searchService;
private DataTypeDefinition nodeRefDataType;
/**
* @param dictionaryService
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* @param searchService
*/
public void setSearchService(SearchService searchService)
{
this.searchService = searchService;
}
/**
* Initialisation
*/
public void afterPropertiesSet() throws Exception
{
nodeRefDataType = dictionaryService.getDataType(DataTypeDefinition.NODE_REF);
}
/**
* Query for node children
*
* @param parent node to query children for
* @param typesFilter types filter
* @return children of node
*/
public NodeRef[] getChildren(NodeRef parent, TypesFilter typesFilter)
{
if (typesFilter == TypesFilter.FoldersAndDocuments)
{
NodeRef[] folders = queryChildren(parent, TypesFilter.Folders);
NodeRef[] docs = queryChildren(parent, TypesFilter.Documents);
NodeRef[] foldersAndDocs = new NodeRef[folders.length + docs.length];
System.arraycopy(folders, 0, foldersAndDocs, 0, folders.length);
System.arraycopy(docs, 0, foldersAndDocs, folders.length, docs.length);
return foldersAndDocs;
}
else if (typesFilter == TypesFilter.Folders)
{
NodeRef[] folders = queryChildren(parent, TypesFilter.Folders);
return folders;
}
else if (typesFilter == TypesFilter.Documents)
{
NodeRef[] docs = queryChildren(parent, TypesFilter.Documents);
return docs;
}
return new NodeRef[0];
}
/**
* Query children helper
*
* NOTE: Queries for folders only or documents only
*
* @param parent node to query children for
* @param typesFilter folders or documents
* @return node children
*/
private NodeRef[] queryChildren(NodeRef parent, TypesFilter typesFilter)
{
SearchParameters params = new SearchParameters();
params.setLanguage(SearchService.LANGUAGE_LUCENE);
params.addStore(parent.getStoreRef());
QueryParameterDefinition parentDef = new QueryParameterDefImpl(PARAM_PARENT, nodeRefDataType, true, parent.toString());
params.addQueryParameterDefinition(parentDef);
if (typesFilter == TypesFilter.Folders)
{
params.setQuery(LUCENE_QUERY_SHALLOW_FOLDERS);
}
else if (typesFilter == TypesFilter.Documents)
{
params.setQuery(LUCENE_QUERY_SHALLOW_FILES);
}
ResultSet resultSet = searchService.query(params);
try
{
List<NodeRef> results = resultSet.getNodeRefs();
NodeRef[] nodeRefs = new NodeRef[results.size()];
return results.toArray(nodeRefs);
}
finally
{
resultSet.close();
}
}
}

View File

@@ -24,6 +24,20 @@
*/
package org.alfresco.repo.cmis.rest;
import java.io.StringReader;
import org.alfresco.util.GUID;
import org.alfresco.web.scripts.Format;
import org.alfresco.web.scripts.atom.AbderaService;
import org.alfresco.web.scripts.atom.AbderaServiceImpl;
import org.apache.abdera.ext.cmis.CMISExtensionFactory;
import org.apache.abdera.ext.cmis.CMISProperties;
import org.apache.abdera.i18n.iri.IRI;
import org.apache.abdera.model.Collection;
import org.apache.abdera.model.Entry;
import org.apache.abdera.model.Feed;
import org.apache.abdera.model.Link;
import org.apache.abdera.model.Service;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -34,11 +48,215 @@ import org.springframework.mock.web.MockHttpServletResponse;
*/
public class TestCMIS extends CMISWebScriptTest
{
public void testRepository() throws Exception
private AbderaService abdera;
private static Service service = null;
private static Entry testFolder = null;
@Override
protected void setUp()
throws Exception
{
MockHttpServletResponse res = getRequest("/api/repository", 200);
assertValidXML(res.getContentAsString(), getAppValidator());
super.setUp();
AbderaServiceImpl abderaImpl = new AbderaServiceImpl();
abderaImpl.afterPropertiesSet();
abderaImpl.registerExtensionFactory(new CMISExtensionFactory());
abdera = abderaImpl;
}
private Service getRepository()
throws Exception
{
if (service == null)
{
MockHttpServletResponse res = getRequest("/api/repository", 200, null);
String xml = res.getContentAsString();
assertNotNull(xml);
assertTrue(xml.length() > 0);
//assertValidXML(xml, getCMISValidator().getAppValidator());
service = abdera.parseService(new StringReader(xml), null);
assertNotNull(service);
}
return service;
}
private IRI getRootCollection(Service service)
{
Collection root = service.getCollection("Main Repository", "root collection");
assertNotNull(root);
IRI rootHREF = root.getHref();
assertNotNull(rootHREF);
return rootHREF;
}
private IRI getCheckedOutCollection(Service service)
{
Collection root = service.getCollection("Main Repository", "checkedout collection");
assertNotNull(root);
IRI rootHREF = root.getHref();
assertNotNull(rootHREF);
return rootHREF;
}
private Entry getTestFolder()
throws Exception
{
if (testFolder == null)
{
testFolder = createTestFolder();
}
return testFolder;
}
private Entry getEntry(IRI href)
throws Exception
{
MockHttpServletResponse res = getRequest(href.toString(), 200, "admin");
assertNotNull(res);
String xml = res.getContentAsString();
Entry entry = abdera.parseEntry(new StringReader(xml), null);
assertNotNull(entry);
assertEquals(href, entry.getSelfLink().getHref());
return entry;
}
private Feed getFeed(IRI href)
throws Exception
{
MockHttpServletResponse res = getRequest(href.toString(), 200, "admin");
assertNotNull(res);
String xml = res.getContentAsString();
Feed feed = abdera.parseFeed(new StringReader(xml), null);
assertNotNull(feed);
assertEquals(href, feed.getSelfLink().getHref());
return feed;
}
private Entry createTestFolder()
throws Exception
{
Service service = getRepository();
IRI rootFolderHREF = getRootCollection(service);
String createFolder = loadString("/cmis/rest/createtestfolder.atomentry.xml");
String guid = GUID.generate();
createFolder = createFolder.replace("${GUID}", guid);
MockHttpServletResponse res = postRequest(rootFolderHREF.toString(), 201, createFolder, Format.ATOMENTRY.mimetype(), "admin");
assertNotNull(res);
String xml = res.getContentAsString();
Entry entry = abdera.parseEntry(new StringReader(xml), null);
assertNotNull(entry);
assertEquals("CMIS Test Folder " + guid, entry.getTitle());
assertEquals("CMIS Test Folder " + guid + " Summary", entry.getSummary());
CMISProperties props = entry.getExtension(CMISExtensionFactory.PROPERTIES);
assertEquals("folder", props.getBaseType());
String testFolderHREF = (String)res.getHeader("Location");
assertNotNull(testFolderHREF);
return entry;
}
private Entry createTestDocument(IRI parent)
throws Exception
{
String createFile = loadString("/cmis/rest/createtestdocument.atomentry.xml");
String guid = GUID.generate();
createFile = createFile.replace("${GUID}", guid);
MockHttpServletResponse res = postRequest(parent.toString(), 201, createFile, Format.ATOMENTRY.mimetype(), "admin");
assertNotNull(res);
String xml = res.getContentAsString();
Entry entry = abdera.parseEntry(new StringReader(xml), null);
assertNotNull(entry);
assertEquals("Test Document " + guid, entry.getTitle());
assertEquals("Test Document " + guid + " Summary", entry.getSummary());
assertNotNull(entry.getContentSrc());
CMISProperties props = entry.getExtension(CMISExtensionFactory.PROPERTIES);
assertEquals("document", props.getBaseType());
String testFileHREF = (String)res.getHeader("Location");
assertNotNull(testFileHREF);
return entry;
}
public void testRepository()
throws Exception
{
Service service = getRepository();
IRI rootHREF = getRootCollection(service);
getRequest(rootHREF.toString(), 200, "admin");
}
public void testCreateTestFolder()
throws Exception
{
createTestFolder();
}
public void testCreateDocument()
throws Exception
{
Entry testFolder = getTestFolder();
Link childrenLink = testFolder.getLink("cmis-children");
assertNotNull(childrenLink);
Feed children = getFeed(childrenLink.getHref());
assertNotNull(children);
int entriesBefore = children.getEntries().size();
Entry document = createTestDocument(children.getSelfLink().getHref());
Feed feedFolderAfter = getFeed(childrenLink.getHref());
int entriesAfter = feedFolderAfter.getEntries().size();
assertEquals(entriesBefore +1, entriesAfter);
Entry entry = feedFolderAfter.getEntry(document.getId().toString());
assertNotNull(entry);
}
public void testGetCheckedOut()
throws Exception
{
// retrieve test folder for checkouts
Entry testFolder = getTestFolder();
Link childrenLink = testFolder.getLink("cmis-children");
Feed scope = getFeed(childrenLink.getHref());
assertNotNull(scope);
CMISProperties props = scope.getExtension(CMISExtensionFactory.PROPERTIES);
String scopeId = props.getObjectId();
assertNotNull(scopeId);
// retrieve checkouts within scope of test checkout folder
Service repository = getRepository();
assertNotNull(repository);
IRI checkedoutHREF = getCheckedOutCollection(service);
Feed checkedout = getFeed(new IRI(checkedoutHREF.toString() + "?folderId=" + scopeId));
assertNotNull(checkedout);
assertEquals(0, checkedout.getEntries().size());
}
public void testCheckout()
throws Exception
{
// retrieve test folder for checkouts
Entry testFolder = getTestFolder();
Link childrenLink = testFolder.getLink("cmis-children");
Feed scope = getFeed(childrenLink.getHref());
// create document for checkout
Entry document = createTestDocument(scope.getSelfLink().getHref());
MockHttpServletResponse documentRes = getRequest(document.getSelfLink().getHref().toString(), 200, "admin");
assertNotNull(documentRes);
String xml = documentRes.getContentAsString();
assertNotNull(xml);
// checkout
IRI checkedoutHREF = getCheckedOutCollection(service);
MockHttpServletResponse checkoutRes = postRequest(checkedoutHREF.toString(), 201, xml, Format.ATOMENTRY.mimetype(), "admin");
assertNotNull(checkoutRes);
// TODO: test private working copy properties
// test getCheckedOut is updated
CMISProperties props = testFolder.getExtension(CMISExtensionFactory.PROPERTIES);
String scopeId = props.getObjectId();
Feed checkedout = getFeed(new IRI(checkedoutHREF.toString() + "?folderId=" + scopeId));
assertNotNull(checkedout);
assertEquals(1, checkedout.getEntries().size());
}
}

View File

@@ -9,18 +9,18 @@
elementFormDefault="qualified"
targetNamespace="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:app="http://www.w3.org/2007/app"
xmlns:cmis="http://www.cmis.org/2008/05"
>
<xs:import namespace="http://www.w3.org/2005/Atom" schemaLocation="ATOM4CMIS.xsd"/>
<xs:import namespace="http://www.cmis.org/2008/05" schemaLocation="CMIS REST.xsd"/>
<xs:import namespace="http://www.cmis.org/2008/05" schemaLocation="CMIS-REST.xsd"/>
<xs:element name="service" type="app:appServiceType"></xs:element>
<xs:complexType name="appServiceType">
<xs:sequence>
<!-- <xs:element ref="atom:author"></xs:element> -->
<xs:element ref="atom:author" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element ref="app:workspace" minOccurs="1" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
@@ -35,7 +35,7 @@
<xs:element ref="app:collection" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute ref="cmis:id"></xs:attribute>
<xs:attribute ref="cmis:repositoryRelationship"></xs:attribute>
<xs:attribute ref="cmis:repositoryRelationship"></xs:attribute>
</xs:complexType>
<xs:element name="collection" type="app:appCollectionType"></xs:element>
@@ -44,11 +44,11 @@
<xs:sequence>
<xs:element ref="atom:title"></xs:element>
</xs:sequence>
<xs:attribute name="href" type="xs:anyURI" use="required"></xs:attribute>
<xs:attribute ref="cmis:id"></xs:attribute>
<xs:attribute ref="cmis:collectionType"></xs:attribute>
<xs:attribute name="href" type="xs:anyURI"></xs:attribute>
</xs:complexType>
<!-- <xs:attribute name="href" type="xs:anyURI"></xs:attribute> -->
<xs:attribute name="href" type="xs:anyURI"></xs:attribute>
</xs:schema>
<!-- EOF -->

View File

@@ -12,9 +12,10 @@
xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
>
<xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml1-strict.xsd"/>
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
<xs:import namespace="http://www.cmis.org/2008/05" schemaLocation="CMIS REST.xsd"/>
<xs:import namespace="http://www.cmis.org/2008/05" schemaLocation="CMIS-REST.xsd"/>
<!-- Common attributes -->
@@ -104,12 +105,7 @@
<xs:group ref="atom:extensionElement"/>
</xs:choice>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="atom:entry"/>
<!--
<xs:choice minOccurs="0" maxOccurs="1">
<xs:group ref="cmis:CMISFolderEntry" />
<xs:group ref="cmis:CMISTypeEntry" />
</xs:choice> -->
<xs:element minOccurs="0" maxOccurs="1" ref="cmis:hasMoreItems"/>
</xs:sequence>
<xs:attributeGroup ref="atom:atomCommonAttributes"/>
@@ -137,17 +133,18 @@
<xs:element ref="atom:updated" />
<xs:group ref="atom:extensionElement" />
<xs:element ref="atom:uri"></xs:element>
</xs:choice>
<!--
</xs:choice>
<xs:sequence>
<xs:element ref="cmis:properties" minOccurs="0" maxOccurs="1"/>
<xs:element ref="cmis:allowableActions" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<!-- This is necessary for nested entries such as descendants -->
<xs:choice minOccurs="0" maxOccurs="1">
<xs:group ref="cmis:CMISDocumentEntry" />
<xs:group ref="cmis:CMISFolderEntry" />
<xs:group ref="cmis:CMISRelationshipEntry" />
<xs:group ref="cmis:CMISPolicyEntry" />
<xs:group ref="cmis:CMISActionsEntry" />
<xs:group ref="cmis:CMISTypeEntry" />
</xs:choice> -->
<xs:element ref="atom:entry" />
</xs:choice>
</xs:sequence>
<xs:attributeGroup ref="atom:atomCommonAttributes"/>
</xs:complexType>
@@ -426,7 +423,6 @@
<xs:element ref="atom:title"></xs:element>
<xs:element ref="cmis:repositoryInfo"></xs:element>
</xs:sequence>
<xs:attribute ref="cmis:id"></xs:attribute>
</xs:complexType>
<xs:element name="collection" type="xs:string"></xs:element>
@@ -435,8 +431,8 @@
<xs:sequence>
<xs:element ref="atom:title"></xs:element>
</xs:sequence>
<xs:attribute ref="cmis:id"></xs:attribute>
<xs:attribute ref="cmis:collectionType"></xs:attribute>
<xs:attribute ref="cmis:id"></xs:attribute>
</xs:complexType>
</xs:schema>
<!-- EOF -->

View File

@@ -14,21 +14,21 @@
<xs:import namespace="http://www.w3.org/XML/1998/namespace" />
<xs:element name="repositoryInfo" type="cmis:repositoryInfoType"></xs:element>
<xs:element name="repositoryInfo" type="cmis:repositoryInfoType"></xs:element>
<xs:element name="property" type="cmis:propertyDefinitionType"></xs:element>
<xs:element name="parent" type="xs:string"></xs:element>
<xs:element name="parentId" type="xs:string"></xs:element>
<xs:element name="displayName" type="xs:string"></xs:element>
<xs:element name="isVersionable" type="xs:boolean"></xs:element>
<xs:element name="description" type="xs:string"></xs:element>
<xs:element name="isQueryable" type="xs:string"></xs:element>
<xs:element name="isCreatable" type="xs:string"></xs:element>
<xs:element name="isQueryable" type="xs:boolean"></xs:element>
<xs:element name="isCreatable" type="xs:boolean"></xs:element>
<xs:element name="queryName" type="xs:string"></xs:element>
<xs:element name="baseTypeQueryName" type="xs:string"></xs:element>
<xs:element name="isContentStreamAllowed" type="xs:boolean"></xs:element>
<xs:element name="AllowedSourceTypes" type="xs:string"></xs:element>
<xs:element name="AllowedTargetTypes" type="xs:string"></xs:element>
<xs:element name="constraints" type="xs:string"></xs:element>
<xs:element name="AllowedSourceTypes" type="xs:string"></xs:element>
<xs:element name="AllowedTargetTypes" type="xs:string"></xs:element>
<xs:element name="constraints" type="xs:string"></xs:element>
<xs:element name="propertyType">
<xs:simpleType>
@@ -90,35 +90,34 @@
</xs:simpleType>
</xs:element>
<xs:complexType name="repositoryInfoType">
<xs:sequence minOccurs="1">
<xs:complexType name="repositoryInfoType">
<xs:sequence minOccurs="1">
<xs:element name="repositoryId" type="xs:string"
minOccurs="1">
</xs:element>
<xs:element name="repositoryName" type="xs:string"
minOccurs="1">
</xs:element>
</xs:element>
<xs:element name="repositoryDescription" type="xs:string"
minOccurs="1">
</xs:element>
<xs:element name="vendorName" type="xs:string"></xs:element>
<xs:element name="productName" type="xs:string"></xs:element>
<xs:element name="productVersion" type="xs:string"></xs:element>
</xs:element>
<xs:element name="vendorName" type="xs:string"></xs:element>
<xs:element name="productName" type="xs:string"></xs:element>
<xs:element name="productVersion" type="xs:string"></xs:element>
<xs:element name="capabilities"
type="cmis:RepositoryInfoCapabilities">
</xs:element>
</xs:element>
<xs:element name="repositorySpecificInformation"
type="xs:string" maxOccurs="1" minOccurs="0">
</xs:element>
<!--
<xs:any namespace="##any" processContents="skip"
</xs:element>
<xs:any namespace="##other" processContents="skip"
minOccurs="0" maxOccurs="unbounded">
</xs:any> -->
</xs:any>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RepositoryInfoCapabilities">
<xs:sequence>
</xs:complexType>
<xs:complexType name="RepositoryInfoCapabilities">
<xs:sequence>
<xs:element name="capabilityMultifiling" type="xs:boolean"
minOccurs="1" maxOccurs="1">
</xs:element>
@@ -144,83 +143,86 @@
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="none"></xs:enumeration>
<xs:enumeration value="fulltextonly"></xs:enumeration>
<xs:enumeration value="fulltextwithmetadata"></xs:enumeration>
<xs:enumeration value="fulltextonly"></xs:enumeration>
<xs:enumeration value="fulltextwithmetadata"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:attribute name="id" type="xs:string"></xs:attribute>
<xs:attribute name="index" type="xs:int"></xs:attribute>
<xs:element name="creationDate" type="xs:dateTime"></xs:element>
<xs:element name="lastModifiedBy" type="xs:dateTime"></xs:element>
<xs:element name="baseType" type="cmis:baseObjectType"></xs:element>
<xs:simpleType name="baseObjectType">
<xs:restriction base="xs:string">
</xs:complexType>
<xs:attribute name="id" type="xs:string"></xs:attribute>
<xs:attribute name="index" type="xs:int"></xs:attribute>
<xs:element name="creationDate" type="xs:dateTime"></xs:element>
<xs:element name="lastModifiedBy" type="xs:dateTime"></xs:element>
<xs:element name="baseType" type="cmis:baseObjectType"></xs:element>
<xs:simpleType name="baseObjectType">
<xs:restriction base="xs:string">
<xs:enumeration value="document"></xs:enumeration>
<xs:enumeration value="folder"></xs:enumeration>
<xs:enumeration value="relationship"></xs:enumeration>
<xs:enumeration value="policy"></xs:enumeration>
<xs:enumeration value="folder"></xs:enumeration>
<xs:enumeration value="relationship"></xs:enumeration>
<xs:enumeration value="policy"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:element name="objectType" type="xs:string"></xs:element>
<xs:element name="isLatestVersion" type="xs:boolean"></xs:element>
<xs:element name="isCheckedOut" type="xs:boolean"></xs:element>
<xs:element name="contentStreamLength" type="xs:int"></xs:element>
<xs:element name="contentStreamMimetype">
<xs:simpleType>
<xs:restriction base="xs:string">
</xs:simpleType>
<xs:element name="objectType" type="xs:string"></xs:element>
<xs:element name="isLatestVersion" type="xs:boolean"></xs:element>
<xs:element name="isCheckedOut" type="xs:boolean"></xs:element>
<xs:element name="contentStreamLength" type="xs:int"></xs:element>
<xs:element name="contentStreamMimetype">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value=".*/.*"></xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="contentStreamName" type="xs:string"></xs:element>
<xs:element name="contentStreamURI" type="xs:string"></xs:element>
</xs:element>
<xs:element name="contentStreamName" type="xs:string"></xs:element>
<xs:element name="contentStreamURI" type="xs:string"></xs:element>
<xs:group name="entryCommonElements">
<xs:sequence>
<xs:group name="entryCommonElements">
<xs:sequence>
<xs:element ref="cmis:objectId" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:baseType" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:lastModifiedBy" minOccurs="1"
maxOccurs="1">
</xs:element>
</xs:element>
<xs:element ref="cmis:creationDate" minOccurs="1"
maxOccurs="1">
</xs:element>
</xs:element>
</xs:sequence>
</xs:group>
<xs:group name="entryContentStreamElements">
<xs:sequence>
</xs:group>
<xs:group name="entryContentStreamElements">
<xs:sequence>
<xs:element ref="cmis:contentStreamLength"></xs:element>
<xs:element ref="cmis:contentStreamMimetype"></xs:element>
<xs:element ref="cmis:contentStreamName"></xs:element>
<xs:element ref="cmis:contentStreamURI"></xs:element>
<xs:element ref="cmis:contentStreamMimetype"></xs:element>
<xs:element ref="cmis:contentStreamName"></xs:element>
<xs:element ref="cmis:contentStreamURI"></xs:element>
</xs:sequence>
</xs:group>
<xs:group name="propertyDefinitionElements">
</xs:group>
<xs:group name="propertyDefinitionElements">
<xs:sequence>
<xs:element ref="cmis:displayName" minOccurs="1"
maxOccurs="1">
@@ -265,10 +267,10 @@
maxOccurs="1">
</xs:element>
</xs:sequence>
</xs:group>
<xs:element name="isOrderable" type="xs:boolean"></xs:element>
</xs:group>
<xs:element name="isOrderable" type="xs:boolean"></xs:element>
<xs:complexType name="propertyDefinitionType">
<xs:sequence>
<xs:element ref="cmis:displayName" minOccurs="1"
@@ -313,14 +315,14 @@
<xs:element ref="cmis:isOrderable" minOccurs="1"
maxOccurs="1">
</xs:element>
</xs:sequence>
<xs:attribute ref="cmis:id"></xs:attribute>
</xs:complexType>
</xs:sequence>
<xs:attribute ref="cmis:id"></xs:attribute>
</xs:complexType>
<xs:element name="canDelete" type="xs:boolean"></xs:element>
<xs:element name="canUpdateProperties" type="xs:boolean"></xs:element>
<xs:element name="canGetProperties" type="xs:boolean"></xs:element>
@@ -345,24 +347,30 @@
<xs:element name="isControllable" type="xs:boolean"></xs:element>
<xs:element name="source" type="xs:string"></xs:element>
<xs:element name="target" type="xs:string"></xs:element>
<xs:element name="isImmutable" type="xs:boolean"></xs:element>
<xs:element name="isMajorVersion" type="xs:boolean"></xs:element>
<xs:element name="isLatestMajorVersion" type="xs:boolean"></xs:element>
<xs:element name="isControllable" type="xs:boolean"></xs:element>
<xs:element name="source" type="xs:string"></xs:element>
<xs:element name="target" type="xs:string"></xs:element>
<xs:element name="isImmutable" type="xs:boolean"></xs:element>
<xs:element name="isMajorVersion" type="xs:boolean"></xs:element>
<xs:element name="isLatestMajorVersion" type="xs:boolean"></xs:element>
<xs:element name="isVersionSeriesCheckedOut" type="xs:boolean"></xs:element>
<xs:element name="versionSeriesCheckedOutBy" type="xs:string"></xs:element>
<xs:element name="versionSeriesCheckedOutID" type="xs:string"></xs:element>
<xs:element name="checkinComment" type="xs:string"></xs:element>
<xs:group name="CMISActionsEntry">
<xs:sequence>
<xs:element ref="cmis:canDelete" minOccurs="0"
<xs:element name="versionSeriesCheckedOutID" type="xs:string"></xs:element>
<xs:element name="checkinComment" type="xs:string"></xs:element>
<xs:group name="CMISActionsEntry">
<xs:sequence>
<xs:element ref="cmis:canDelete" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:parentId" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:parentUrl" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:canUpdateProperties" minOccurs="0"
@@ -419,13 +427,13 @@
<xs:element ref="cmis:canGetChildren" minOccurs="0"
maxOccurs="1">
</xs:element>
</xs:sequence>
</xs:sequence>
</xs:group>
</xs:group>
<xs:group name="CMISTypeEntry">
<xs:sequence>
<xs:group name="CMISTypeEntry">
<xs:sequence>
<xs:group ref="cmis:entryCommonElements" minOccurs="1"
maxOccurs="1">
</xs:group>
@@ -434,19 +442,17 @@
</xs:element>
<xs:element ref="cmis:displayName" minOccurs="1"
maxOccurs="1">
</xs:element>
<!--
<xs:element ref="cmis:baseType" minOccurs="1"
maxOccurs="1">
</xs:element> -->
</xs:element>
<xs:element ref="cmis:baseTypeQueryName" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:parent" minOccurs="1" maxOccurs="1"></xs:element>
<xs:element ref="cmis:parentId" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:description" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:isCreatable" minOccurs="1"
<xs:element ref="cmis:isCreatable" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:isVersionable" minOccurs="1"
@@ -458,26 +464,25 @@
<xs:element ref="cmis:isContentStreamAllowed" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:AllowedSourceTypes" minOccurs="1" maxOccurs="1">
</xs:element>
<xs:element ref="cmis:AllowedTargetTypes" minOccurs="1" maxOccurs="1">
</xs:element>
<xs:element ref="cmis:constraints" minOccurs="0"
<xs:element ref="cmis:isControllable" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:AllowedSourceTypes" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:AllowedTargetTypes" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:property" minOccurs="0"
maxOccurs="unbounded">
</xs:element>
</xs:sequence>
<xs:element ref="cmis:property"></xs:element>
<xs:element ref="cmis:isControllable"></xs:element>
</xs:sequence>
</xs:group>
</xs:group>
<xs:group name="CMISDocumentEntry">
<xs:sequence>
<xs:group ref="cmis:entryCommonElements" minOccurs="1"
maxOccurs="1">
</xs:group>
<xs:group name="CMISDocumentEntry">
<xs:sequence>
<xs:element ref="cmis:objectType" minOccurs="1"
maxOccurs="1">
</xs:element>
@@ -489,21 +494,21 @@
</xs:element>
<xs:element ref="cmis:isMajorVersion" minOccurs="0"
maxOccurs="1">
</xs:element>
</xs:element>
<xs:element ref="cmis:isLatestMajorVersion" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:isImmutable" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:isVersionSeriesCheckedOut" minOccurs="0"
maxOccurs="1">
<xs:element ref="cmis:isVersionSeriesCheckedOut"
minOccurs="0" maxOccurs="1">
</xs:element>
<xs:element ref="cmis:versionSeriesCheckedOutBy" minOccurs="0"
maxOccurs="1">
<xs:element ref="cmis:versionSeriesCheckedOutBy"
minOccurs="0" maxOccurs="1">
</xs:element>
<xs:element ref="cmis:versionSeriesCheckedOutID" minOccurs="0"
maxOccurs="1">
<xs:element ref="cmis:versionSeriesCheckedOutID"
minOccurs="0" maxOccurs="1">
</xs:element>
<xs:element ref="cmis:checkinComment" minOccurs="1"
maxOccurs="1">
@@ -512,125 +517,145 @@
<xs:element ref="cmis:versionLabel" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:group ref="cmis:entryContentStreamElements"
minOccurs="0" maxOccurs="1">
</xs:group>
<xs:element ref="cmis:allowableActions" minOccurs="0"
maxOccurs="1">
</xs:element>
</xs:sequence>
</xs:group>
</xs:sequence>
</xs:group>
<xs:group name="CMISFolderEntry">
<xs:sequence>
<xs:group ref="cmis:entryCommonElements" minOccurs="1"
maxOccurs="1">
</xs:group>
<xs:group name="CMISFolderEntry">
<xs:sequence>
<xs:element ref="cmis:objectType" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:parent" minOccurs="1" maxOccurs="1"></xs:element>
<xs:element ref="cmis:allowableActions" minOccurs="0"
maxOccurs="1">
</xs:element>
</xs:sequence>
</xs:group>
<xs:group name="CMISRelationshipEntry">
<xs:sequence>
<xs:group ref="cmis:entryCommonElements" minOccurs="1"
maxOccurs="1">
</xs:group>
<xs:element ref="cmis:objectType" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:source" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:target" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:allowableActions" minOccurs="0"
<xs:element ref="cmis:parentId" minOccurs="1"
maxOccurs="1">
</xs:element>
</xs:sequence>
</xs:group>
</xs:group>
<xs:group name="CMISPolicyEntry">
<xs:sequence>
<xs:group ref="cmis:entryCommonElements" minOccurs="1"
maxOccurs="1">
</xs:group>
<xs:group name="CMISRelationshipEntry">
<xs:sequence>
<xs:element ref="cmis:objectType" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:allowableActions" minOccurs="0"
<xs:element ref="cmis:source" minOccurs="1" maxOccurs="1">
</xs:element>
<xs:element ref="cmis:target" minOccurs="1" maxOccurs="1">
</xs:element>
</xs:sequence>
</xs:group>
<xs:group name="CMISPolicyEntry">
<xs:sequence>
<xs:element ref="cmis:objectType" minOccurs="1"
maxOccurs="1">
</xs:element>
</xs:sequence>
</xs:group>
<xs:element name="function" type="xs:string"></xs:element>
<xs:element name="hasMoreItems" type="xs:boolean"></xs:element>
<xs:element name="allowableActions" type="cmis:allowableActions"></xs:element>
<xs:complexType name="allowableActions">
<xs:sequence maxOccurs="1" minOccurs="1">
<xs:group ref="cmis:CMISActionsEntry"></xs:group>
</xs:sequence>
</xs:complexType>
<xs:element name="versionLabel" type="xs:string"></xs:element>
<xs:element name="query" type="cmis:queryType"></xs:element>
<xs:complexType name="queryType">
<xs:sequence>
<xs:element ref="cmis:statement" minOccurs="1" maxOccurs="1"></xs:element>
<xs:element ref="cmis:searchAllVersions" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element ref="cmis:pageSize" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element ref="cmis:skipCount" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element ref="cmis:returnAllowableActions" minOccurs="0" maxOccurs="1"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="statement" type="xs:string"></xs:element>
<xs:element name="pageSize" type="xs:int"></xs:element>
<xs:element name="skipCount" type="xs:int"></xs:element>
<xs:element name="returnAllowableActions" type="xs:boolean"></xs:element>
<xs:element name="searchAllVersions" type="xs:boolean"></xs:element>
<xs:attribute name="collectionType">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="root"></xs:enumeration>
<xs:enumeration value="unfiled"></xs:enumeration>
<xs:enumeration value="checkedout"></xs:enumeration>
<xs:enumeration value="types"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="repositoryRelationship">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="self"></xs:enumeration>
<xs:enumeration value="sibling"></xs:enumeration>
<xs:enumeration value="parent"></xs:enumeration>
<xs:enumeration value="child"></xs:enumeration>
<xs:enumeration value="replica"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:sequence>
</xs:group>
<xs:element name="function" type="xs:string"></xs:element>
<xs:element name="hasMoreItems" type="xs:boolean"></xs:element>
<xs:element name="allowableActions" type="cmis:allowableActions"></xs:element>
<xs:complexType name="allowableActions">
<xs:sequence maxOccurs="1" minOccurs="1">
<xs:group ref="cmis:CMISActionsEntry"></xs:group>
</xs:sequence>
</xs:complexType>
<xs:element name="versionLabel" type="xs:string"></xs:element>
<xs:element name="query" type="cmis:queryType"></xs:element>
<xs:complexType name="queryType">
<xs:sequence>
<xs:element ref="cmis:statement" minOccurs="1"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:searchAllVersions" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:pageSize" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:skipCount" minOccurs="0"
maxOccurs="1">
</xs:element>
<xs:element ref="cmis:returnAllowableActions" minOccurs="0"
maxOccurs="1">
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="statement" type="xs:string"></xs:element>
<xs:element name="pageSize" type="xs:int"></xs:element>
<xs:element name="skipCount" type="xs:int"></xs:element>
<xs:element name="returnAllowableActions" type="xs:boolean"></xs:element>
<xs:element name="searchAllVersions" type="xs:boolean"></xs:element>
<xs:attribute name="collectionType">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="root"></xs:enumeration>
<xs:enumeration value="unfiled"></xs:enumeration>
<xs:enumeration value="checkedout"></xs:enumeration>
<xs:enumeration value="types"></xs:enumeration>
<xs:enumeration value="query"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="repositoryRelationship">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="self"></xs:enumeration>
<xs:enumeration value="sibling"></xs:enumeration>
<xs:enumeration value="parent"></xs:enumeration>
<xs:enumeration value="child"></xs:enumeration>
<xs:enumeration value="replica"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:complexType name="typeType">
<xs:sequence>
<xs:group ref="cmis:CMISTypeEntry"></xs:group>
</xs:sequence>
</xs:complexType>
<xs:element name="objectId" type="xs:string"></xs:element>
<xs:element name="type" type="cmis:typeType"></xs:element>
<xs:element name="parentUrl" type="xs:anyURI"></xs:element>
<xs:element name="properties" type="cmis:propertiesType"></xs:element>
<xs:complexType name="propertiesType">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="1">
<xs:group ref="cmis:entryCommonElements" minOccurs="1"
maxOccurs="1">
</xs:group>
</xs:choice>
<xs:choice minOccurs="0" maxOccurs="1">
<xs:group ref="cmis:CMISDocumentEntry" />
<xs:group ref="cmis:CMISFolderEntry" />
<xs:group ref="cmis:CMISRelationshipEntry" />
<xs:group ref="cmis:CMISPolicyEntry" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:schema>
<!-- EOF -->

View File

@@ -0,0 +1,160 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.cmis.rest.xsd;
import java.io.IOException;
import java.io.StringReader;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/**
* CMIS Validator
*
* Support for validating CMIS requests/responses against CMIS XSDs
*
* @author davidc
*/
public class CMISValidator
{
/** XML Schema Validation */
private DocumentBuilder documentBuilder = null;
private Validator appValidator = null;
private Validator atomValidator = null;
/**
* Gets document parser
*
* @return document parser
* @throws ParserConfigurationException
*/
public DocumentBuilder getDocumentBuilder()
throws ParserConfigurationException
{
if (documentBuilder == null)
{
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(true);
documentBuilder = builderFactory.newDocumentBuilder();
}
return documentBuilder;
}
/**
* Gets CMIS Atom Publishing Protocol XML Validator
*
* @return APP Validator
* @throws IOException
* @throws SAXException
*/
public Validator getAppValidator()
throws IOException, SAXException
{
if (appValidator == null)
{
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source APPFile = new StreamSource(getClass().getResourceAsStream("APP.xsd"), getClass().getResource("APP.xsd").toExternalForm());
Schema schema = factory.newSchema(APPFile);
appValidator = schema.newValidator();
}
return appValidator;
}
/**
* Gets CMIS Atom Validator
*
* @return CMIS Atom Validator
* @throws IOException
* @throws SAXException
*/
public Validator getCMISAtomValidator()
throws IOException, SAXException
{
if (atomValidator == null)
{
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source ATOM4CMISFile = new StreamSource(getClass().getResourceAsStream("ATOM4CMIS.xsd"), getClass().getResource("ATOM4CMIS.xsd").toExternalForm());
Schema schema = factory.newSchema(ATOM4CMISFile);
atomValidator = schema.newValidator();
}
return atomValidator;
}
/**
* Asserts XML complies with specified Validator
*
* @param xml xml to assert
* @param validator validator to assert with
* @throws IOException
* @throws ParserConfigurationException
*/
public void validateXML(String xml, Validator validator)
throws IOException, ParserConfigurationException, SAXException
{
Document document = getDocumentBuilder().parse(new InputSource(new StringReader(xml)));
validator.validate(new DOMSource(document));
}
/**
* Convert SAX Exception to String
*
* @param e SAX Exception
* @param xml related XML (if any)
* @return description of SAX Exception
*/
public String toString(SAXException e, String xml)
{
StringBuffer fail = new StringBuffer(e.toString());
if (e instanceof SAXParseException)
{
fail.append("\n");
fail.append("line: ").append(((SAXParseException)e).getLineNumber()).append("\n");
fail.append("col: ").append(((SAXParseException)e).getColumnNumber()).append("\n");
}
if (xml != null)
{
fail.append("\n");
fail.append(xml);
}
return fail.toString();
}
}

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<cmis:allowableActions xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/Atom ../ATOM4CMIS.xsd http://www.cmis.org/2008/05 C:\Java\eclipse\workspace\p8cmis\src\main\resources\rest-schema\CMIS-REST.xsd ">
<!-- all -->
<cmis:canDelete>true</cmis:canDelete>
<!-- if not embedded in entry -->
<cmis:parentId>cmis:parentId</cmis:parentId>
<cmis:parentUrl>http://tempuri.org</cmis:parentUrl>
<!-- all -->
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<!-- policy, document -->
<cmis:canGetParents>true</cmis:canGetParents>
<!-- folder -->
<cmis:canGetDescendants>true</cmis:canGetDescendants>
<!-- doc, folder, policy -->
<cmis:canMove>true</cmis:canMove>
<!-- doc -->
<cmis:canDeleteVersion>true</cmis:canDeleteVersion>
<cmis:canDeleteContent>true</cmis:canDeleteContent>
<cmis:canCheckout>true</cmis:canCheckout>
<cmis:canCancelCheckout>true</cmis:canCancelCheckout>
<cmis:canCheckin>true</cmis:canCheckin>
<cmis:canSetContent>true</cmis:canSetContent>
<cmis:canGetAllVersions>true</cmis:canGetAllVersions>
<cmis:canAddToFolder>true</cmis:canAddToFolder>
<cmis:canRemoveFromFolder>true</cmis:canRemoveFromFolder>
<cmis:canViewContent>true</cmis:canViewContent>
<!-- doc, folder, policy -->
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
<!-- folder -->
<cmis:canGetChildren>true</cmis:canGetChildren>
</cmis:allowableActions>

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xml:base="http://tempuri.org" xml:lang=""
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/Atom ../ATOM4CMIS.xsd http://www.cmis.org/2008/05 C:\Java\eclipse\workspace\p8cmis\src\main\resources\rest-schema\CMIS-REST.xsd ">
<title>Document Entry example</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/document-entry</atom:id>
<atom:link rel='self'
href="http://www.cmis.org/rep1/document-entry" />
<!-- lastModifiedDate -->
<atom:updated>2001-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/document-entry" />
<atom:link rel="edit-media"
href="http://www.cmis.org/rep1/media/document-entry" />
<atom:link rel="enclosure"
href="http://www.cmis.org/rep1/media/document-entry" />
<atom:link rel="alternate"
href="http://www.cmis.org/rep1/media/document-entry" />
<!-- CMIS Links -->
<atom:link rel="cmis-parents"
href="http://www.cmis.org/rep1/document-entry/parents" />
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/document-entry/actions" />
<atom:link rel="cmis-allversions"
href="http://www.cmis.org/rep1/document-entry/allversions" />
<atom:link rel="cmis-latestversion"
href="http://www.cmis.org/rep1/document-entry/latestversion" />
<atom:link rel="cmis-relationships"
href="http://www.cmis.org/rep1/document-entry/relationships" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/email" />
<atom:link rel="cmis-stream"
href="http://www.cmis.org/rep1/media/document-entry" />
<!-- atom:content -->
<atom:content src="http://www.cmis.org/rep1/media/document-entry">
</atom:content>
<atom:summary>
<!-- auto-generated HTML table of properties -->
</atom:summary>
<cmis:properties>
<cmis:objectId>docid1</cmis:objectId>
<cmis:baseType>document</cmis:baseType>
<cmis:lastModifiedBy>2001-12-31T12:00:00</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:objectType>email</cmis:objectType>
<cmis:isCheckedOut>false</cmis:isCheckedOut>
<cmis:isLatestVersion>true</cmis:isLatestVersion>
<cmis:isMajorVersion>true</cmis:isMajorVersion>
<cmis:isLatestMajorVersion>true</cmis:isLatestMajorVersion>
<cmis:isImmutable>false</cmis:isImmutable>
<cmis:isVersionSeriesCheckedOut>
false
</cmis:isVersionSeriesCheckedOut>
<cmis:versionSeriesCheckedOutBy></cmis:versionSeriesCheckedOutBy>
<cmis:versionSeriesCheckedOutID></cmis:versionSeriesCheckedOutID>
<cmis:checkinComment>
This is the initial checkin comment
</cmis:checkinComment>
<cmis:versionLabel>1.0</cmis:versionLabel>
<cmis:contentStreamLength>70</cmis:contentStreamLength>
<cmis:contentStreamMimetype>
text/plain
</cmis:contentStreamMimetype>
<cmis:contentStreamName>foo.txt</cmis:contentStreamName>
<cmis:contentStreamURI>
http://www.cmis.org/rep1/media/document-entry
</cmis:contentStreamURI>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canGetParents>true</cmis:canGetParents>
<cmis:canMove>true</cmis:canMove>
<cmis:canDeleteVersion>true</cmis:canDeleteVersion>
<cmis:canDeleteContent>true</cmis:canDeleteContent>
<cmis:canCheckout>true</cmis:canCheckout>
<cmis:canCancelCheckout>true</cmis:canCancelCheckout>
<cmis:canCheckin>true</cmis:canCheckin>
<cmis:canSetContent>true</cmis:canSetContent>
<cmis:canGetAllVersions>true</cmis:canGetAllVersions>
<cmis:canAddToFolder>true</cmis:canAddToFolder>
<cmis:canRemoveFromFolder>true</cmis:canRemoveFromFolder>
<cmis:canViewContent>true</cmis:canViewContent>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
</cmis:allowableActions>
</atom:entry>

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xml:base="http://tempuri.org" xml:lang=""
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/Atom ../ATOM4CMIS.xsd http://www.cmis.org/2008/05 C:\Java\eclipse\workspace\p8cmis\src\main\resources\rest-schema\CMIS-REST.xsd ">
<title>Document Entry example PWC</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/document-entry</atom:id>
<atom:link rel='self'
href="http://www.cmis.org/rep1/document-entry" />
<!-- lastModifiedDate -->
<atom:updated>2007-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/document-entry" />
<atom:link rel="edit-media"
href="http://www.cmis.org/rep1/media/document-entry" />
<atom:link rel="enclosure"
href="http://www.cmis.org/rep1/media/document-entry" />
<atom:link rel="alternate"
href="http://www.cmis.org/rep1/media/document-entry" />
<!-- CMIS Links -->
<atom:link rel="cmis-parents"
href="http://www.cmis.org/rep1/document-entry/parents" />
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/document-entry/actions" />
<atom:link rel="cmis-allversions"
href="http://www.cmis.org/rep1/document-entry/allversions" />
<atom:link rel="cmis-latestversion"
href="http://www.cmis.org/rep1/document-entry/latestversion" />
<atom:link rel="cmis-relationships"
href="http://www.cmis.org/rep1/document-entry/relationships" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/email" />
<atom:link rel="cmis-stream"
href="http://www.cmis.org/rep1/media/document-entry" />
<!-- atom:content -->
<atom:content src="http://www.cmis.org/rep1/media/document-entry">
</atom:content>
<atom:summary>
<!-- auto-generated HTML table of properties -->
</atom:summary>
<cmis:properties>
<cmis:objectId>docid1pwc</cmis:objectId>
<cmis:baseType>document</cmis:baseType>
<cmis:lastModifiedBy>2001-12-31T12:00:00</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:objectType>email</cmis:objectType>
<!-- PWC -->
<cmis:isCheckedOut>true</cmis:isCheckedOut>
<cmis:isLatestVersion>true</cmis:isLatestVersion>
<cmis:isMajorVersion>false</cmis:isMajorVersion>
<cmis:isLatestMajorVersion>false</cmis:isLatestMajorVersion>
<cmis:isImmutable>false</cmis:isImmutable>
<!-- PWC -->
<cmis:isVersionSeriesCheckedOut>
true
</cmis:isVersionSeriesCheckedOut>
<cmis:versionSeriesCheckedOutBy>Al Brown</cmis:versionSeriesCheckedOutBy>
<cmis:versionSeriesCheckedOutID>docid1pwc</cmis:versionSeriesCheckedOutID>
<cmis:checkinComment></cmis:checkinComment>
<!-- PWC -->
<cmis:versionLabel>1.1</cmis:versionLabel>
<cmis:contentStreamLength>70</cmis:contentStreamLength>
<cmis:contentStreamMimetype>
text/plain
</cmis:contentStreamMimetype>
<cmis:contentStreamName>foo.txt</cmis:contentStreamName>
<cmis:contentStreamURI>
http://www.cmis.org/rep1/media/document-entry
</cmis:contentStreamURI>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canGetParents>true</cmis:canGetParents>
<cmis:canMove>true</cmis:canMove>
<cmis:canDeleteVersion>true</cmis:canDeleteVersion>
<cmis:canDeleteContent>true</cmis:canDeleteContent>
<cmis:canCheckout>false</cmis:canCheckout>
<cmis:canCancelCheckout>true</cmis:canCancelCheckout>
<cmis:canCheckin>true</cmis:canCheckin>
<cmis:canSetContent>true</cmis:canSetContent>
<cmis:canGetAllVersions>true</cmis:canGetAllVersions>
<cmis:canAddToFolder>true</cmis:canAddToFolder>
<cmis:canRemoveFromFolder>true</cmis:canRemoveFromFolder>
<cmis:canViewContent>true</cmis:canViewContent>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
</cmis:allowableActions>
</atom:entry>

View File

@@ -0,0 +1,208 @@
<?xml version="1.0" encoding="UTF-8"?>
<atom:feed xml:base="http://tempuri.org" xml:lang=""
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/Atom ../ATOM4CMIS.xsd http://www.cmis.org/2008/05 C:\Java\eclipse\workspace\p8cmis\src\main\resources\rest-schema\CMIS-REST.xsd ">
<!-- This is a feed of folder containing:
folder1\
folder2
docid1
-->
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<atom:title>Folder1's Children - page 3</atom:title>
<atom:link href="http://www.cmis.org/rep1/folder1/children/3" />
<!-- Points to the folder entry document -->
<atom:link rel="cmis-source" href="http://www.cmis.org/rep1/folder1" />
<atom:updated>2007-12-31T12:00:00</atom:updated>
<!-- RFC 5005 Feed Paging -->
<atom:link rel="first"
href="http://www.cmis.org/rep1/folder1/children" />
<atom:link rel="next"
href="http://www.cmis.org/rep1/folder1/children/4" />
<atom:link rel="previous"
href="http://www.cmis.org/rep1/folder1/children/2" />
<atom:link rel="last"
href="http://www.cmis.org/rep1/folder1/children/last" />
<!-- sub-folder 1 -->
<atom:entry xml:base="http://tempuri.org" xml:lang="en-US">
<title>Folder Entry example (folder2)</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/folder-entry2</atom:id>
<atom:link rel='self'
href="http://www.cmis.org/rep1/folder-entry2" />
<!-- lastModifiedDate -->
<atom:updated>2001-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/folder-entry2" />
<!-- CMIS Links -->
<atom:link rel="cmis-parent"
href="http://www.cmis.org/rep1/folder-entry2/parent" />
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/folder-entry2/actions" />
<atom:link rel="cmis-relationships"
href="http://www.cmis.org/rep1/folder-entry2/relationships" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/emailfolder" />
<!-- atom:content -->
<atom:content>
<!-- auto-generated HTML table of properties -->
Folder Entry Example (folderid2) Property1 Value1
</atom:content>
<cmis:properties>
<cmis:objectId>folderid2</cmis:objectId>
<cmis:baseType>folder</cmis:baseType>
<cmis:lastModifiedBy>
2001-12-31T12:00:00
</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:objectType>emailfolder</cmis:objectType>
<cmis:parentId>folderid1</cmis:parentId>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canGetParents>true</cmis:canGetParents>
<cmis:canGetDescendants>true</cmis:canGetDescendants>
<cmis:canMove>true</cmis:canMove>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
<cmis:canGetChildren>true</cmis:canGetChildren>
</cmis:allowableActions>
</atom:entry>
<atom:entry xml:base="http://tempuri.org" xml:lang="">
<title>Document Entry example</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/document-entry</atom:id>
<atom:link rel='self'
href="http://www.cmis.org/rep1/document-entry" />
<!-- lastModifiedDate -->
<atom:updated>2001-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/document-entry" />
<atom:link rel="edit-media"
href="http://www.cmis.org/rep1/media/document-entry" />
<atom:link rel="enclosure"
href="http://www.cmis.org/rep1/media/document-entry" />
<atom:link rel="alternate"
href="http://www.cmis.org/rep1/media/document-entry" />
<!-- CMIS Links -->
<atom:link rel="cmis-parents"
href="http://www.cmis.org/rep1/document-entry/parents" />
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/document-entry/actions" />
<atom:link rel="cmis-allversions"
href="http://www.cmis.org/rep1/document-entry/allversions" />
<atom:link rel="cmis-latestversion"
href="http://www.cmis.org/rep1/document-entry/latestversion" />
<atom:link rel="cmis-relationships"
href="http://www.cmis.org/rep1/document-entry/relationships" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/email" />
<atom:link rel="cmis-stream"
href="http://www.cmis.org/rep1/media/document-entry" />
<!-- atom:content -->
<atom:content
src="http://www.cmis.org/rep1/media/document-entry">
</atom:content>
<atom:summary>
<!-- auto-generated HTML table of properties -->
</atom:summary>
<cmis:properties>
<cmis:objectId>docid1</cmis:objectId>
<cmis:baseType>document</cmis:baseType>
<cmis:lastModifiedBy>
2001-12-31T12:00:00
</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:objectType>email</cmis:objectType>
<cmis:isCheckedOut>false</cmis:isCheckedOut>
<cmis:isLatestVersion>true</cmis:isLatestVersion>
<cmis:isMajorVersion>true</cmis:isMajorVersion>
<cmis:isLatestMajorVersion>true</cmis:isLatestMajorVersion>
<cmis:isImmutable>false</cmis:isImmutable>
<cmis:isVersionSeriesCheckedOut>
false
</cmis:isVersionSeriesCheckedOut>
<cmis:versionSeriesCheckedOutBy></cmis:versionSeriesCheckedOutBy>
<cmis:versionSeriesCheckedOutID></cmis:versionSeriesCheckedOutID>
<cmis:checkinComment>
This is the initial checkin comment
</cmis:checkinComment>
<cmis:versionLabel>1.0</cmis:versionLabel>
<cmis:contentStreamLength>70</cmis:contentStreamLength>
<cmis:contentStreamMimetype>
text/plain
</cmis:contentStreamMimetype>
<cmis:contentStreamName>foo.txt</cmis:contentStreamName>
<cmis:contentStreamURI>
http://www.cmis.org/rep1/media/document-entry
</cmis:contentStreamURI>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canGetParents>true</cmis:canGetParents>
<cmis:canMove>true</cmis:canMove>
<cmis:canDeleteVersion>true</cmis:canDeleteVersion>
<cmis:canDeleteContent>true</cmis:canDeleteContent>
<cmis:canCheckout>true</cmis:canCheckout>
<cmis:canCancelCheckout>true</cmis:canCancelCheckout>
<cmis:canCheckin>true</cmis:canCheckin>
<cmis:canSetContent>true</cmis:canSetContent>
<cmis:canGetAllVersions>true</cmis:canGetAllVersions>
<cmis:canAddToFolder>true</cmis:canAddToFolder>
<cmis:canRemoveFromFolder>true</cmis:canRemoveFromFolder>
<cmis:canViewContent>true</cmis:canViewContent>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
</cmis:allowableActions>
</atom:entry>
<!-- notification of more items -->
<cmis:hasMoreItems>true</cmis:hasMoreItems>
</atom:feed>

View File

@@ -0,0 +1,326 @@
<?xml version="1.0" encoding="UTF-8"?>
<atom:feed xml:base="http://tempuri.org" xml:lang=""
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/Atom ../ATOM4CMIS.xsd http://www.cmis.org/2008/05 C:\Java\eclipse\workspace\p8cmis\src\main\resources\rest-schema\CMIS-REST.xsd ">
<!-- This is a feed of folder containing:
folder1\
folder2\
docid2
docid1
-->
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<atom:title>Folder1's Children - page 3</atom:title>
<atom:link href="http://www.cmis.org/rep1/folder1/children/3" />
<!-- Points to the folder entry document -->
<atom:link rel="cmis-source"
href="http://www.cmis.org/rep1/folder1" />
<atom:updated>2007-12-31T12:00:00</atom:updated>
<!-- RFC 5005 Feed Paging -->
<atom:link rel="first"
href="http://www.cmis.org/rep1/folder1/children" />
<atom:link rel="next"
href="http://www.cmis.org/rep1/folder1/children/4" />
<atom:link rel="previous"
href="http://www.cmis.org/rep1/folder1/children/2" />
<atom:link rel="last"
href="http://www.cmis.org/rep1/folder1/children/last" />
<!-- sub-folder 1 -->
<atom:entry xml:base="http://tempuri.org" xml:lang="en-US">
<title>Folder Entry example (folder2)</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/folder-entry2</atom:id>
<atom:link rel='self'
href="http://www.cmis.org/rep1/folder-entry2" />
<!-- lastModifiedDate -->
<atom:updated>2001-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/folder-entry2" />
<!-- CMIS Links -->
<atom:link rel="cmis-parent"
href="http://www.cmis.org/rep1/folder-entry2/parent" />
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/folder-entry2/actions" />
<atom:link rel="cmis-relationships"
href="http://www.cmis.org/rep1/folder-entry2/relationships" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/emailfolder" />
<!-- atom:content -->
<atom:content>
<!-- auto-generated HTML table of properties -->
Folder Entry Example (folderid2) Property1 Value1
</atom:content>
<cmis:properties>
<cmis:objectId>folderid2</cmis:objectId>
<cmis:baseType>folder</cmis:baseType>
<cmis:lastModifiedBy>
2001-12-31T12:00:00
</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:objectType>emailfolder</cmis:objectType>
<cmis:parentId>folderid1</cmis:parentId>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canGetParents>true</cmis:canGetParents>
<cmis:canGetDescendants>true</cmis:canGetDescendants>
<cmis:canMove>true</cmis:canMove>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
<cmis:canGetChildren>true</cmis:canGetChildren>
</cmis:allowableActions>
<!-- docid2 -->
<atom:entry xml:base="http://tempuri.org" xml:lang="">
<title>Document Entry example</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/document-entry2</atom:id>
<atom:link rel='self'
href="http://www.cmis.org/rep1/document-entry2" />
<!-- lastModifiedDate -->
<atom:updated>2001-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/document-entry2" />
<atom:link rel="edit-media"
href="http://www.cmis.org/rep1/media/document-entry2" />
<atom:link rel="enclosure"
href="http://www.cmis.org/rep1/media/document-entry2" />
<atom:link rel="alternate"
href="http://www.cmis.org/rep1/media/document-entry2" />
<!-- CMIS Links -->
<atom:link rel="cmis-parents"
href="http://www.cmis.org/rep1/document-entry2/parents" />
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/document-entry2/actions" />
<atom:link rel="cmis-allversions"
href="http://www.cmis.org/rep1/document-entry2/allversions" />
<atom:link rel="cmis-latestversion"
href="http://www.cmis.org/rep1/document-entry2/latestversion" />
<atom:link rel="cmis-relationships"
href="http://www.cmis.org/rep1/document-entry2/relationships" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/email" />
<atom:link rel="cmis-stream"
href="http://www.cmis.org/rep1/media/document-entry2" />
<!-- atom:content -->
<atom:content
src="http://www.cmis.org/rep1/media/document-entry2">
</atom:content>
<atom:summary>
<!-- auto-generated HTML table of properties -->
</atom:summary>
<cmis:properties>
<cmis:objectId>docid2</cmis:objectId>
<cmis:baseType>document</cmis:baseType>
<cmis:lastModifiedBy>
2001-12-31T12:00:00
</cmis:lastModifiedBy>
<cmis:creationDate>
2001-12-31T12:00:00
</cmis:creationDate>
<cmis:objectType>email</cmis:objectType>
<cmis:isCheckedOut>false</cmis:isCheckedOut>
<cmis:isLatestVersion>true</cmis:isLatestVersion>
<cmis:isMajorVersion>true</cmis:isMajorVersion>
<cmis:isLatestMajorVersion>
true
</cmis:isLatestMajorVersion>
<cmis:isImmutable>false</cmis:isImmutable>
<cmis:isVersionSeriesCheckedOut>
false
</cmis:isVersionSeriesCheckedOut>
<cmis:versionSeriesCheckedOutBy></cmis:versionSeriesCheckedOutBy>
<cmis:versionSeriesCheckedOutID></cmis:versionSeriesCheckedOutID>
<cmis:checkinComment>
This is the initial checkin comment
</cmis:checkinComment>
<cmis:versionLabel>1.0</cmis:versionLabel>
<cmis:contentStreamLength>700</cmis:contentStreamLength>
<cmis:contentStreamMimetype>
text/plain
</cmis:contentStreamMimetype>
<cmis:contentStreamName>foo2.txt</cmis:contentStreamName>
<cmis:contentStreamURI>
http://www.cmis.org/rep1/media/document-entry2
</cmis:contentStreamURI>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>
true
</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canGetParents>true</cmis:canGetParents>
<cmis:canMove>true</cmis:canMove>
<cmis:canDeleteVersion>true</cmis:canDeleteVersion>
<cmis:canDeleteContent>true</cmis:canDeleteContent>
<cmis:canCheckout>true</cmis:canCheckout>
<cmis:canCancelCheckout>true</cmis:canCancelCheckout>
<cmis:canCheckin>true</cmis:canCheckin>
<cmis:canSetContent>true</cmis:canSetContent>
<cmis:canGetAllVersions>true</cmis:canGetAllVersions>
<cmis:canAddToFolder>true</cmis:canAddToFolder>
<cmis:canRemoveFromFolder>
true
</cmis:canRemoveFromFolder>
<cmis:canViewContent>true</cmis:canViewContent>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
</cmis:allowableActions>
</atom:entry>
</atom:entry>
<atom:entry xml:base="http://tempuri.org" xml:lang="">
<title>Document Entry example</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/document-entry</atom:id>
<atom:link rel='self'
href="http://www.cmis.org/rep1/document-entry" />
<!-- lastModifiedDate -->
<atom:updated>2001-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/document-entry" />
<atom:link rel="edit-media"
href="http://www.cmis.org/rep1/media/document-entry" />
<atom:link rel="enclosure"
href="http://www.cmis.org/rep1/media/document-entry" />
<atom:link rel="alternate"
href="http://www.cmis.org/rep1/media/document-entry" />
<!-- CMIS Links -->
<atom:link rel="cmis-parents"
href="http://www.cmis.org/rep1/document-entry/parents" />
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/document-entry/actions" />
<atom:link rel="cmis-allversions"
href="http://www.cmis.org/rep1/document-entry/allversions" />
<atom:link rel="cmis-latestversion"
href="http://www.cmis.org/rep1/document-entry/latestversion" />
<atom:link rel="cmis-relationships"
href="http://www.cmis.org/rep1/document-entry/relationships" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/email" />
<atom:link rel="cmis-stream"
href="http://www.cmis.org/rep1/media/document-entry" />
<!-- atom:content -->
<atom:content
src="http://www.cmis.org/rep1/media/document-entry">
</atom:content>
<atom:summary>
<!-- auto-generated HTML table of properties -->
</atom:summary>
<cmis:properties>
<cmis:objectId>docid1</cmis:objectId>
<cmis:baseType>document</cmis:baseType>
<cmis:lastModifiedBy>
2001-12-31T12:00:00
</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:objectType>email</cmis:objectType>
<cmis:isCheckedOut>false</cmis:isCheckedOut>
<cmis:isLatestVersion>true</cmis:isLatestVersion>
<cmis:isMajorVersion>true</cmis:isMajorVersion>
<cmis:isLatestMajorVersion>true</cmis:isLatestMajorVersion>
<cmis:isImmutable>false</cmis:isImmutable>
<cmis:isVersionSeriesCheckedOut>
false
</cmis:isVersionSeriesCheckedOut>
<cmis:versionSeriesCheckedOutBy></cmis:versionSeriesCheckedOutBy>
<cmis:versionSeriesCheckedOutID></cmis:versionSeriesCheckedOutID>
<cmis:checkinComment>
This is the initial checkin comment
</cmis:checkinComment>
<cmis:versionLabel>1.0</cmis:versionLabel>
<cmis:contentStreamLength>70</cmis:contentStreamLength>
<cmis:contentStreamMimetype>
text/plain
</cmis:contentStreamMimetype>
<cmis:contentStreamName>foo.txt</cmis:contentStreamName>
<cmis:contentStreamURI>
http://www.cmis.org/rep1/media/document-entry
</cmis:contentStreamURI>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canGetParents>true</cmis:canGetParents>
<cmis:canMove>true</cmis:canMove>
<cmis:canDeleteVersion>true</cmis:canDeleteVersion>
<cmis:canDeleteContent>true</cmis:canDeleteContent>
<cmis:canCheckout>true</cmis:canCheckout>
<cmis:canCancelCheckout>true</cmis:canCancelCheckout>
<cmis:canCheckin>true</cmis:canCheckin>
<cmis:canSetContent>true</cmis:canSetContent>
<cmis:canGetAllVersions>true</cmis:canGetAllVersions>
<cmis:canAddToFolder>true</cmis:canAddToFolder>
<cmis:canRemoveFromFolder>true</cmis:canRemoveFromFolder>
<cmis:canViewContent>true</cmis:canViewContent>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
</cmis:allowableActions>
</atom:entry>
<!-- notification of more items -->
<cmis:hasMoreItems>true</cmis:hasMoreItems>
</atom:feed>

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xml:base="http://tempuri.org" xml:lang="en-US"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/Atom ../ATOM4CMIS.xsd http://www.cmis.org/2008/05 C:\Java\eclipse\workspace\p8cmis\src\main\resources\rest-schema\CMIS-REST.xsd ">
<title>Folder Entry example</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/folder-entry</atom:id>
<atom:link rel='self' href="http://www.cmis.org/rep1/folder-entry" />
<!-- lastModifiedDate -->
<atom:updated>2001-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/folder-entry" />
<!-- CMIS Links -->
<atom:link rel="cmis-parent"
href="http://www.cmis.org/rep1/folder-entry/parent" />
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/folder-entry/actions" />
<atom:link rel="cmis-relationships"
href="http://www.cmis.org/rep1/folder-entry/relationships" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/emailfolder" />
<!-- atom:content -->
<atom:content>
<!-- auto-generated HTML table of properties -->
Folder Entry Example (folderid1) Property1 Value1
</atom:content>
<cmis:properties>
<cmis:objectId>folderid1</cmis:objectId>
<cmis:baseType>folder</cmis:baseType>
<cmis:lastModifiedBy>2001-12-31T12:00:00</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:objectType>emailfolder</cmis:objectType>
<cmis:parentId>ParentFolderId</cmis:parentId>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canGetParents>true</cmis:canGetParents>
<cmis:canGetDescendants>true</cmis:canGetDescendants>
<cmis:canMove>true</cmis:canMove>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
<cmis:canGetChildren>true</cmis:canGetChildren>
</cmis:allowableActions>
</atom:entry>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xml:base="http://tempuri.org" xml:lang="en-US"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/Atom ../ATOM4CMIS.xsd http://www.cmis.org/2008/05 C:\Java\eclipse\workspace\p8cmis\src\main\resources\rest-schema\CMIS-REST.xsd ">
<title>Policy Entry example</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/policy-entry</atom:id>
<atom:link rel='self'
href="http://www.cmis.org/rep1/policy-entry" />
<!-- lastModifiedDate -->
<atom:updated>2001-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/v-entry" />
<!-- CMIS Links -->
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/policy-entry/actions" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/securitypolicy" />
<atom:link rel="cmis-source"
href="http://www.cmis.org/rep1/policy-entry/source" />
<atom:link rel="cmis-target"
href="http://www.cmis.org/rep1/policy-entry/target" />
<!-- atom:content -->
<atom:content>
<!-- auto-generated HTML table of properties -->
Policy Entry Example (policyid1) Property1 Value1
</atom:content>
<cmis:properties>
<cmis:objectId>policyid1</cmis:objectId>
<cmis:baseType>policy</cmis:baseType>
<cmis:lastModifiedBy>2001-12-31T12:00:00</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:objectType>securitypolicy</cmis:objectType>
<cmis:source>docid1</cmis:source>
<cmis:target>docid2</cmis:target>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
</cmis:allowableActions>
</atom:entry>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<cmis:query xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:p="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.cmis.org/2008/05 ../CMIS-REST.xsd ">
<cmis:statement>SELECT * FROM document</cmis:statement>
<cmis:searchAllVersions>true</cmis:searchAllVersions>
<cmis:pageSize>0</cmis:pageSize>
<cmis:skipCount>0</cmis:skipCount>
<cmis:returnAllowableActions>false</cmis:returnAllowableActions>
</cmis:query>

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xml:base="http://tempuri.org" xml:lang="en-US"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/Atom ../ATOM4CMIS.xsd http://www.cmis.org/2008/05 C:\Java\eclipse\workspace\p8cmis\src\main\resources\rest-schema\CMIS-REST.xsd ">
<title>Relationship Entry example</title>
<atom:author xml:base="http://tempuri.org" xml:lang="">
<atom:name>Al Brown</atom:name>
</atom:author>
<!-- URI to document entry resource -->
<atom:id>http://www.cmis.org/rep1/relationship-entry</atom:id>
<atom:link rel='self'
href="http://www.cmis.org/rep1/relationship-entry" />
<!-- lastModifiedDate -->
<atom:updated>2001-12-31T12:00:00</atom:updated>
<!-- createdDate -->
<atom:published>2001-12-31T12:00:00</atom:published>
<!-- atom links -->
<atom:link rel="edit"
href="http://www.cmis.org/rep1/relationship-entry" />
<!-- CMIS Links -->
<atom:link rel="cmis-allowableactions"
href="http://www.cmis.org/rep1/relationship-entry/actions" />
<atom:link rel="cmis-type"
href="http://www.cmis.org/rep1/type/emaillink" />
<atom:link rel="cmis-source"
href="http://www.cmis.org/rep1/relationship-entry/source" />
<atom:link rel="cmis-target"
href="http://www.cmis.org/rep1/relationship-entry/target" />
<!-- atom:content -->
<atom:content>
<!-- auto-generated HTML table of properties -->
Relationship Entry Example (relid1) Property1 Value1
</atom:content>
<cmis:properties>
<cmis:objectId>relid1</cmis:objectId>
<cmis:baseType>relationship</cmis:baseType>
<cmis:lastModifiedBy>2001-12-31T12:00:00</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:objectType>emaillink</cmis:objectType>
<cmis:source>docid1</cmis:source>
<cmis:target>docid2</cmis:target>
</cmis:properties>
<!-- Optional Allowable actions -->
<cmis:allowableActions>
<cmis:canDelete>true</cmis:canDelete>
<cmis:canUpdateProperties>true</cmis:canUpdateProperties>
<cmis:canGetProperties>true</cmis:canGetProperties>
<cmis:canAddPolicy>true</cmis:canAddPolicy>
<cmis:canRemovePolicy>true</cmis:canRemovePolicy>
</cmis:allowableActions>
</atom:entry>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<app:service xmlns:app="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xsi:schemaLocation="http://www.w3.org/2007/app APP.xsd http://www.w3.org/2005/Atom ATOM4CMIS.xsd http://www.cmis.org/2008/05 CMIS-REST.xsd ">
<app:workspace cmis:repositoryRelationship="self">
<atom:title>Repository 1</atom:title>
<cmis:repositoryInfo>
<cmis:repositoryId>repid1</cmis:repositoryId>
<cmis:repositoryName>repository1</cmis:repositoryName>
<cmis:repositoryDescription>Repository Description</cmis:repositoryDescription>
<cmis:vendorName>ACME Vendor</cmis:vendorName>
<cmis:productName>ACME Repository</cmis:productName>
<cmis:productVersion>ACME Version 99.01</cmis:productVersion>
<cmis:capabilities>
<cmis:capabilityMultifiling>true</cmis:capabilityMultifiling>
<cmis:capabilityUnfiling>true</cmis:capabilityUnfiling>
<cmis:capabilityVersionSpecificFiling>true</cmis:capabilityVersionSpecificFiling>
<cmis:capabilityPWCUpdateable>true</cmis:capabilityPWCUpdateable>
<cmis:capabilityAllVersionsSearchable>true</cmis:capabilityAllVersionsSearchable>
<cmis:capabilityInnerJoin>true</cmis:capabilityInnerJoin>
<cmis:capabilityOuterJoin>true</cmis:capabilityOuterJoin>
<cmis:capabilityFullText>fulltextwithmetadata</cmis:capabilityFullText>
</cmis:capabilities>
<cmis:repositorySpecificInformation>Welcome to ACME 99</cmis:repositorySpecificInformation>
</cmis:repositoryInfo>
<app:collection cmis:collectionType="unfiled" href="http://www.cmis.org/rep1/unfiled">
<atom:title>unfiled collection</atom:title>
</app:collection>
<app:collection cmis:collectionType="root" href="http://www.cmis.org/rep1/root">
<atom:title>root collection</atom:title>
</app:collection>
<app:collection cmis:collectionType="checkedout" href="http://www.cmis.org/rep1/checkedout">
<atom:title>checkedout collection</atom:title>
</app:collection>
<app:collection cmis:collectionType="types" href="http://www.cmis.org/rep1/types">
<atom:title>type collection</atom:title>
</app:collection>
<app:collection cmis:collectionType="query" href="http://www.cmis.org/rep1/query">
<atom:title>type collection</atom:title>
</app:collection>
</app:workspace>
</app:service>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<cmis:type xmlns:cmis="http://www.cmis.org/2008/05"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.cmis.org/2008/05 CMIS-REST.xsd ">
<cmis:objectId>documentTypeId</cmis:objectId>
<cmis:baseType>document</cmis:baseType>
<cmis:lastModifiedBy>2001-12-31T12:00:00</cmis:lastModifiedBy>
<cmis:creationDate>2001-12-31T12:00:00</cmis:creationDate>
<cmis:queryName>document</cmis:queryName>
<cmis:displayName>document</cmis:displayName>
<cmis:baseTypeQueryName>document</cmis:baseTypeQueryName>
<cmis:parentId></cmis:parentId>
<cmis:description>The document type</cmis:description>
<cmis:isCreatable>true</cmis:isCreatable>
<cmis:isVersionable>true</cmis:isVersionable>
<cmis:isQueryable>true</cmis:isQueryable>
<cmis:isContentStreamAllowed>true</cmis:isContentStreamAllowed>
<cmis:isControllable>true</cmis:isControllable>
<cmis:property cmis:id="foo1">
<cmis:displayName>foo1</cmis:displayName>
<cmis:description>Description of foo1</cmis:description>
<cmis:propertyType>String</cmis:propertyType>
<cmis:cardinality>Single</cmis:cardinality>
<cmis:maxLength>64</cmis:maxLength>
<cmis:choices index="1">cmis:choices</cmis:choices>
<cmis:isOpenChoice>true</cmis:isOpenChoice>
<cmis:isRequired>true</cmis:isRequired>
<cmis:defaultValue>cmis:defaultValue</cmis:defaultValue>
<cmis:updateability>ro</cmis:updateability>
<cmis:isQueryable>true</cmis:isQueryable>
<cmis:isOrderable>true</cmis:isOrderable>
</cmis:property>
</cmis:type>

View File

@@ -0,0 +1,144 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.cmis.rest.xsd;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.XMLConstants;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import junit.framework.TestCase;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* CMIS XSD Tests
*
* @author davidc
*/
public class TestXSDs extends TestCase
{
private CMISValidator cmisValidator = new CMISValidator();
/**
* Gets XML from file specified by class path
*
* @param classPath XML file
* @return XML
* @throws IOException
*/
private String getXML(String classPath)
throws IOException
{
InputStream input = getClass().getResourceAsStream(classPath);
if (input == null)
{
throw new IOException(classPath + " not found.");
}
InputStreamReader reader = new InputStreamReader(input);
StringWriter writer = new StringWriter();
try
{
char[] buffer = new char[4096];
int bytesRead = -1;
while ((bytesRead = reader.read(buffer)) != -1)
{
writer.write(buffer, 0, bytesRead);
}
writer.flush();
}
finally
{
reader.close();
writer.close();
}
return writer.toString();
}
/**
* Assert XML is valid according to specified validator
*
* @param xml document to test
* @param validator validator to test with
* @throws IOException
* @throws ParserConfigurationException
*/
private void assertValidXML(String xml, Validator validator)
throws IOException, ParserConfigurationException
{
try
{
Document document = cmisValidator.getDocumentBuilder().parse(new InputSource(new StringReader(xml)));
validator.validate(new DOMSource(document));
}
catch (SAXException e)
{
fail(cmisValidator.toString(e, xml));
}
}
// public void testRelaxNG()
// throws Exception
// {
// String xml = getXML("address.xml");
// SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.RELAXNG_NS_URI);
// Source schemaFile = new StreamSource(getClass().getResourceAsStream("address.rng"), getClass().getResource("address.rng").toExternalForm());
// Schema schema = factory.newSchema(schemaFile);
// assertValidXML(xml, schema.newValidator());
// }
public void testService()
throws Exception
{
String xml = getXML("Example-Service.xml");
assertValidXML(xml, cmisValidator.getAppValidator());
}
public void testFolderChildren()
throws Exception
{
String xml = getXML("Example-FolderChildren.xml");
assertValidXML(xml, cmisValidator.getCMISAtomValidator());
}
}

View File

@@ -0,0 +1,27 @@
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
<zeroOrMore>
<element name="card">
<choice>
<element name="givenName">
<text/>
</element>
<group>
<element name="givenName">
<text/>
</element>
<element name="familyName">
<text/>
</element>
</group>
</choice>
<element name="email">
<text/>
</element>
<optional>
<element name="note">
<text/>
</element>
</optional>
</element>
</zeroOrMore>
</element>

View File

@@ -0,0 +1,12 @@
<addressBook>
<card>
<givenName>John</givenName>
<familyName>Smith</familyName>
<email>js@example.com</email>
</card>
<card>
<givenName>Fred Bloggs</givenName>
<email>fb@example.net</email>
<note/>
</card>
</addressBook>

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" ?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:alf="http://www.alfresco.org" xmlns:app="http://www.w3.org/2007/app" xmlns:cmis="http://www.cmis.org/2008/05" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<author><name>System</name></author>
<generator version="3.0.0 (SeaMistPreview1 @build-number@)">Alfresco (Community Network)</generator>
<icon>http://localhost:8080/alfresco/images/logo/AlfrescoLogo16.ico</icon>
<id>urn:uuid:78974cc9-2e91-11dd-add7-d79ea16aaad7</id>
<title>Company Home</title>
<updated>2008-05-30T22:44:50.379+01:00</updated>
<link href="http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore//children" rel="self"/>
<opensearch:totalResults>31</opensearch:totalResults>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>0</opensearch:itemsPerPage>
<link href="http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore//children?pageNo=1&amp;guest=&amp;format=atomfeed" rel="first" type="application/atom+xml;type=feed"/>
<link href="http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore//children?pageNo=1&amp;guest=&amp;format=atomfeed" rel="last" type="application/atom+xml;type=feed"/>
<entry>
<author><name>System</name></author>
<content>78aef380-2e91-11dd-add7-d79ea16aaad7</content>
<id>urn:uuid:78aef380-2e91-11dd-add7-d79ea16aaad7</id>
<published>2008-05-30T22:43:42.120+01:00</published>
<summary>User managed definitions</summary>
<title>Data Dictionary</title>
<updated>2008-05-30T22:44:50.575+01:00</updated>
<link href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/78aef380-2e91-11dd-add7-d79ea16aaad7" rel="self"/>
<app:edited>2008-05-30T22:44:50.575+01:00</app:edited>
<link href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/78aef380-2e91-11dd-add7-d79ea16aaad7" rel="edit"/>
<alf:icon>http://localhost:8080/alfresco/images/icons/space-icon-default-16.gif</alf:icon>
<link href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/78aef380-2e91-11dd-add7-d79ea16aaad7/permissions" rel="cmis-allowableactions"/>
<link href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/78aef380-2e91-11dd-add7-d79ea16aaad7/associations" rel="cmis-relationships"/>
<link href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/78aef380-2e91-11dd-add7-d79ea16aaad7/parent" rel="cmis-parent"/>
<link href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/78aef380-2e91-11dd-add7-d79ea16aaad7/children" rel="cmis-children"/>
<link href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/78aef380-2e91-11dd-add7-d79ea16aaad7/descendants" rel="cmis-descendants"/>
<cmis:objectId>workspace://SpacesStore/78aef380-2e91-11dd-add7-d79ea16aaad7</cmis:objectId>
<cmis:baseType>folder</cmis:baseType>
<!-- <cmis:createdBy>System</cmis:createdBy> -->
<cmis:creationDate>2008-05-30T22:43:42.120+01:00</cmis:creationDate>
<!-- <cmis:lastModifiedBy>System</cmis:lastModifiedBy> -->
<cmis:lastModificationDate>2008-05-30T22:44:50.575+01:00</cmis:lastModificationDate>
<cmis:name>Data Dictionary</cmis:name>
<cmis:parent>workspace://SpacesStore/78974cc9-2e91-11dd-add7-d79ea16aaad7</cmis:parent>
</entry>
</feed>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" ?><service xmlns="http://www.w3.org/2007/app" xmlns:alf="http://www.alfresco.org" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://www.cmis.org/2008/05">
<workspace cmis:id="786f2b47-2e91-11dd-add7-d79ea16aaad7">
<atom:title>Main Repository</atom:title>
<cmis:repositoryInfo>
<cmis:repositoryId>786f2b47-2e91-11dd-add7-d79ea16aaad7</cmis:repositoryId>
<cmis:repositoryName>Main Repository</cmis:repositoryName>
<cmis:repositoryDescription/>
<cmis:vendorName>Alfresco</cmis:vendorName>
<cmis:productName>Alfresco Repository (Community Network)</cmis:productName>
<cmis:productVersion>3.0.0 (SeaMistPreview1 @build-number@)</cmis:productVersion>
<cmis:capabilities>
<cmis:capabilityMultifiling>true</cmis:capabilityMultifiling>
<cmis:capabilityUnfiling>false</cmis:capabilityUnfiling>
<cmis:capabilityVersionSpecificFiling>false</cmis:capabilityVersionSpecificFiling>
<cmis:capabilityPWCUpdateable>true</cmis:capabilityPWCUpdateable>
<cmis:capabilityAllVersionsSearchable>false</cmis:capabilityAllVersionsSearchable>
<cmis:capabilityInnerJoin>true</cmis:capabilityInnerJoin>
<cmis:capabilityOuterJoin>true</cmis:capabilityOuterJoin>
<cmis:capabilityFullText>fulltextwithmetadata</cmis:capabilityFullText>
</cmis:capabilities>
<cmis:repositorySpecificInformation/>
</cmis:repositoryInfo>
<collection cmis:collectionType="root" href="http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore//children">
<atom:title>CMIS root folder</atom:title>
</collection>
<collection cmis:collectionType="checkedout" href="http://example.org/cmis/main?checkedout">
<atom:title>CMIS checked-out documents</atom:title>
</collection>
<collection cmis:collectionType="types" href="http://example.org/cmis/main?types">
<atom:title>CMIS Types</atom:title>
</collection>
</workspace>
</service>

View File

@@ -27,11 +27,13 @@ package org.alfresco.repo.web.scripts;
import java.io.IOException;
import java.util.HashMap;
import junit.framework.TestCase;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.web.scripts.TestWebScriptServer;
import org.springframework.mock.web.MockHttpServletResponse;
import junit.framework.TestCase;
/**
* Base unit test class for web scripts.
*
@@ -56,7 +58,7 @@ public abstract class BaseWebScriptTest extends TestCase
}
return BaseWebScriptTest.server;
}
/**
* "GET" the url and check for the expected status code
*
@@ -68,7 +70,7 @@ public abstract class BaseWebScriptTest extends TestCase
protected MockHttpServletResponse getRequest(String url, int expectedStatus)
throws IOException
{
return sendRequest(METHOD_GET, url, expectedStatus, null, null);
return getRequest(url, expectedStatus, null);
}
/**
@@ -85,6 +87,21 @@ public abstract class BaseWebScriptTest extends TestCase
return sendRequest(METHOD_DELETE, url, expectedStatus, null, null);
}
/**
* "GET" the url and check for the expected status code
*
* @param url
* @param expectedStatus
* @param asUser
* @return
* @throws IOException
*/
protected MockHttpServletResponse getRequest(String url, int expectedStatus, String asUser)
throws IOException
{
return sendRequest(METHOD_GET, url, expectedStatus, null, null, asUser);
}
/**
* "POST" the url and check for the expected status code
*
@@ -98,7 +115,22 @@ public abstract class BaseWebScriptTest extends TestCase
protected MockHttpServletResponse postRequest(String url, int expectedStatus, String body, String contentType)
throws IOException
{
return postRequest(url, expectedStatus, body.getBytes(), contentType);
return postRequest(url, expectedStatus, body.getBytes(), contentType, null);
}
/**
* "POST" the url and check for the expected status code
*
* @param url
* @param expectedStatus
* @param asUser
* @return
* @throws IOException
*/
protected MockHttpServletResponse postRequest(String url, int expectedStatus, String body, String contentType, String asUser)
throws IOException
{
return postRequest(url, expectedStatus, body.getBytes(), contentType, asUser);
}
/**
@@ -112,11 +144,26 @@ public abstract class BaseWebScriptTest extends TestCase
protected MockHttpServletResponse postRequest(String url, int expectedStatus, byte[] body, String contentType)
throws IOException
{
return sendRequest(METHOD_POST, url, expectedStatus, body, contentType);
return postRequest(url, expectedStatus, body, contentType, null);
}
/**
* "PUT" the url and check for the expected status code
* "POST" the url and check for the expected status code
*
* @param url
* @param expectedStatus
* @param asUser
* @return
* @throws IOException
*/
protected MockHttpServletResponse postRequest(String url, int expectedStatus, byte[] body, String contentType, String asUser)
throws IOException
{
return sendRequest(METHOD_POST, url, expectedStatus, body, contentType, asUser);
}
/**
* Send request to Test Web Script Server
*
* @param url
* @param expectedStatus
@@ -136,21 +183,34 @@ public abstract class BaseWebScriptTest extends TestCase
* @param method
* @param url
* @param expectedStatus
* @param body
* @param contentType
* @param asUser
* @return
* @throws IOException
*/
private MockHttpServletResponse sendRequest(String method, String url, int expectedStatus, byte[] body, String contentType)
private MockHttpServletResponse sendRequest(final String method, final String url, final int expectedStatus, final byte[] body, final String contentType, String asUser)
throws IOException
{
MockHttpServletResponse response = BaseWebScriptTest.getServer().submitRequest(method, url, new HashMap<String, String>(), body, contentType);
// send request in context of specified user
String runAsUser = (asUser == null) ? AuthenticationUtil.getSystemUserName() : asUser;
MockHttpServletResponse response = AuthenticationUtil.runAs(new RunAsWork<MockHttpServletResponse>()
{
@SuppressWarnings("synthetic-access")
public MockHttpServletResponse doWork() throws Exception
{
return BaseWebScriptTest.getServer().submitRequest(method, url, new HashMap<String, String>(), body, contentType);
}
}, runAsUser);
if (expectedStatus > 0 && expectedStatus != response.getStatus())
{
//if (response.getStatus() == 500)
//{
System.out.println(response.getContentAsString());
// System.out.println(response.getContentAsString());
//}
fail("Expected status code " + expectedStatus + " , " + response.getStatus() + " was returned");
fail("Status code " + response.getStatus() + " returned, but expected " + expectedStatus + " for " + url + " (" + method + ")");
}
return response;
}

View File

@@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletResponse;
import org.alfresco.repo.cache.SimpleCache;
import org.alfresco.repo.model.Repository;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.template.CropContentMethod;
import org.alfresco.repo.tenant.TenantDeployer;
import org.alfresco.repo.tenant.TenantDeployerService;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
@@ -179,6 +180,7 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
Map<String, Object> params = new HashMap<String, Object>();
params.putAll(super.getTemplateParameters());
params.put(TemplateService.KEY_IMAGE_RESOLVER, imageResolver.getImageResolver());
params.put("cropContent", new CropContentMethod());
addRepoParameters(params);
return params;
}

View File

@@ -74,6 +74,7 @@ public class TestWebScriptRepoServer extends TestWebScriptServer
try
{
TestWebScriptServer testServer = getTestServer();
AuthenticationUtil.setSystemUserAsCurrentUser();
testServer.rep();
}
catch(Throwable e)

View File

@@ -41,9 +41,10 @@ import javax.xml.namespace.QName;
*/
public interface CMISConstants
{
public static final String CMIS_V10_NS = "http://www.cmis.org/CMIS/1.0";
public static final String CMIS_200805_NS = "http://www.cmis.org/2008/05";
public static final QName OBJECT = new QName(CMIS_V10_NS, "object");
public static final QName BASETYPE = new QName(CMIS_V10_NS, "baseType");
public static final QName PROPERTIES = new QName(CMIS_200805_NS, "properties");
public static final QName OBJECTID = new QName(CMIS_200805_NS, "objectId");
public static final QName BASETYPE = new QName(CMIS_200805_NS, "baseType");
}

View File

@@ -45,8 +45,8 @@ public class CMISExtensionFactory extends AbstractExtensionFactory
public CMISExtensionFactory()
{
super(CMIS_V10_NS);
addImpl(OBJECT, CMISObject.class);
super(CMIS_200805_NS);
addImpl(PROPERTIES, CMISProperties.class);
}
}

View File

@@ -41,16 +41,22 @@ import org.apache.abdera.model.ElementWrapper;
*
* @author davidc
*/
public class CMISObject extends ElementWrapper
public class CMISProperties extends ElementWrapper
{
public CMISObject(Element internal)
public CMISProperties(Element internal)
{
super(internal);
}
public CMISObject(Factory factory)
public CMISProperties(Factory factory)
{
super(factory, CMISConstants.OBJECT);
super(factory, CMISConstants.PROPERTIES);
}
public String getObjectId()
{
Element child = getInternal().getFirstChild(CMISConstants.OBJECTID);
return (child == null) ? null : child.getText();
}
public String getBaseType()