You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2010/04/16 16:14:02 UTC
svn commit: r934896 [5/12] - in
/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server:
chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/
chemistry-opencmis-server-bindings/src/main/java/org/apache/chemi...
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java Fri Apr 16 14:14:00 2010
@@ -52,126 +52,121 @@ import org.apache.chemistry.opencmis.ser
*/
public class VersioningService {
- /**
- * Check Out.
- */
- public static void checkOut(CallContext context, AbstractServicesFactory factory,
- String repositoryId, HttpServletRequest request, HttpServletResponse response)
- throws Exception {
- CmisVersioningService service = factory.getVersioningService();
-
- // get parameters
- AtomEntryParser parser = new AtomEntryParser(request.getInputStream());
-
- // execute
- ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
- ObjectData object = service.checkOut(context, repositoryId, new Holder<String>(parser.getId()),
- null, null, objectInfoHolder);
-
- if (object == null) {
- throw new CmisRuntimeException("Object is null!");
- }
-
- if (object.getId() == null) {
- throw new CmisRuntimeException("Object Id is null!");
- }
-
- // set headers
- UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
- String location = compileUrl(baseUrl, RESOURCE_ENTRY, object.getId());
-
- response.setStatus(HttpServletResponse.SC_CREATED);
- response.setContentType(Constants.MEDIATYPE_ENTRY);
- response.setHeader("Content-Location", location);
- response.setHeader("Location", location);
-
- // write XML
- AtomEntry entry = new AtomEntry();
- entry.startDocument(response.getOutputStream());
- writeObjectEntry(entry, object, objectInfoHolder, null, repositoryId, null, null, baseUrl, true);
- entry.endDocument();
- }
-
- /**
- * Get all versions.
- */
- public static void getAllVersions(CallContext context, AbstractServicesFactory factory,
- String repositoryId, HttpServletRequest request, HttpServletResponse response)
- throws Exception {
- CmisVersioningService service = factory.getVersioningService();
-
- // get parameters
- String versionSeriesId = getStringParameter(request, Constants.PARAM_ID);
- String filter = getStringParameter(request, Constants.PARAM_FILTER);
- Boolean includeAllowableActions = getBooleanParameter(request,
- Constants.PARAM_ALLOWABLE_ACTIONS);
-
- // execute
- ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
- List<ObjectData> versions = service.getAllVersions(context, repositoryId, versionSeriesId,
- filter, includeAllowableActions, null, objectInfoHolder);
-
- if (versions == null) {
- throw new CmisRuntimeException("Versions are null!");
- }
-
- ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(versionSeriesId);
- if (objectInfo == null) {
- throw new CmisRuntimeException("Version Series Info is missing!");
- }
-
- // set headers
- response.setStatus(HttpServletResponse.SC_OK);
- response.setContentType(Constants.MEDIATYPE_FEED);
-
- // write XML
- AtomFeed feed = new AtomFeed();
- feed.startDocument(response.getOutputStream());
- feed.startFeed(true);
-
- // write basic Atom feed elements
- feed.writeFeedElements(objectInfo.getId(), objectInfo.getCreatedBy(), objectInfo.getName(),
- objectInfo.getLastModificationDate(), null, null);
-
- // write links
- UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
-
- feed.writeServiceLink(baseUrl.toString(), repositoryId);
-
- feed.writeSelfLink(compileUrl(baseUrl, RESOURCE_VERSIONS, objectInfo.getId()), null);
-
- feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, versionSeriesId));
-
- // write entries
- AtomEntry entry = new AtomEntry(feed.getWriter());
- for (ObjectData object : versions) {
- if (object == null) {
- continue;
- }
- writeObjectEntry(entry, object, objectInfoHolder, null, repositoryId, null, null, baseUrl,
- false);
- }
-
- // we are done
- feed.endFeed();
- feed.endDocument();
- }
-
- /**
- * Delete object.
- */
- public static void deleteAllVersions(CallContext context, AbstractServicesFactory factory,
- String repositoryId, HttpServletRequest request, HttpServletResponse response)
- throws Exception {
- CmisObjectService service = factory.getObjectService();
-
- // get parameters
- String objectId = getStringParameter(request, Constants.PARAM_ID);
-
- // execute
- service.deleteObjectOrCancelCheckOut(context, repositoryId, objectId, Boolean.TRUE, null);
-
- // set headers
- response.setStatus(HttpServletResponse.SC_NO_CONTENT);
- }
+ /**
+ * Check Out.
+ */
+ public static void checkOut(CallContext context, AbstractServicesFactory factory, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ CmisVersioningService service = factory.getVersioningService();
+
+ // get parameters
+ AtomEntryParser parser = new AtomEntryParser(request.getInputStream());
+
+ // execute
+ ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
+ ObjectData object = service.checkOut(context, repositoryId, new Holder<String>(parser.getId()), null, null,
+ objectInfoHolder);
+
+ if (object == null) {
+ throw new CmisRuntimeException("Object is null!");
+ }
+
+ if (object.getId() == null) {
+ throw new CmisRuntimeException("Object Id is null!");
+ }
+
+ // set headers
+ UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+ String location = compileUrl(baseUrl, RESOURCE_ENTRY, object.getId());
+
+ response.setStatus(HttpServletResponse.SC_CREATED);
+ response.setContentType(Constants.MEDIATYPE_ENTRY);
+ response.setHeader("Content-Location", location);
+ response.setHeader("Location", location);
+
+ // write XML
+ AtomEntry entry = new AtomEntry();
+ entry.startDocument(response.getOutputStream());
+ writeObjectEntry(entry, object, objectInfoHolder, null, repositoryId, null, null, baseUrl, true);
+ entry.endDocument();
+ }
+
+ /**
+ * Get all versions.
+ */
+ public static void getAllVersions(CallContext context, AbstractServicesFactory factory, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ CmisVersioningService service = factory.getVersioningService();
+
+ // get parameters
+ String versionSeriesId = getStringParameter(request, Constants.PARAM_ID);
+ String filter = getStringParameter(request, Constants.PARAM_FILTER);
+ Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
+
+ // execute
+ ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
+ List<ObjectData> versions = service.getAllVersions(context, repositoryId, versionSeriesId, filter,
+ includeAllowableActions, null, objectInfoHolder);
+
+ if (versions == null) {
+ throw new CmisRuntimeException("Versions are null!");
+ }
+
+ ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(versionSeriesId);
+ if (objectInfo == null) {
+ throw new CmisRuntimeException("Version Series Info is missing!");
+ }
+
+ // set headers
+ response.setStatus(HttpServletResponse.SC_OK);
+ response.setContentType(Constants.MEDIATYPE_FEED);
+
+ // write XML
+ AtomFeed feed = new AtomFeed();
+ feed.startDocument(response.getOutputStream());
+ feed.startFeed(true);
+
+ // write basic Atom feed elements
+ feed.writeFeedElements(objectInfo.getId(), objectInfo.getCreatedBy(), objectInfo.getName(), objectInfo
+ .getLastModificationDate(), null, null);
+
+ // write links
+ UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
+
+ feed.writeServiceLink(baseUrl.toString(), repositoryId);
+
+ feed.writeSelfLink(compileUrl(baseUrl, RESOURCE_VERSIONS, objectInfo.getId()), null);
+
+ feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, versionSeriesId));
+
+ // write entries
+ AtomEntry entry = new AtomEntry(feed.getWriter());
+ for (ObjectData object : versions) {
+ if (object == null) {
+ continue;
+ }
+ writeObjectEntry(entry, object, objectInfoHolder, null, repositoryId, null, null, baseUrl, false);
+ }
+
+ // we are done
+ feed.endFeed();
+ feed.endDocument();
+ }
+
+ /**
+ * Delete object.
+ */
+ public static void deleteAllVersions(CallContext context, AbstractServicesFactory factory, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ CmisObjectService service = factory.getObjectService();
+
+ // get parameters
+ String objectId = getStringParameter(request, Constants.PARAM_ID);
+
+ // execute
+ service.deleteObjectOrCancelCheckOut(context, repositoryId, objectId, Boolean.TRUE, null);
+
+ // set headers
+ response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java Fri Apr 16 14:14:00 2010
@@ -34,71 +34,71 @@ import org.apache.chemistry.opencmis.com
*/
public abstract class XMLDocumentBase {
- public static final String PREFIX_ATOM = "atom";
- public static final String PREFIX_CMIS = "cmis";
- public static final String PREFIX_RESTATOM = "cmisra";
- public static final String PREFIX_APP = "app";
- public static final String PREFIX_XSI = "xsi";
-
- private XMLStreamWriter fWriter;
-
- /**
- * Sets the namespaces for the document.
- */
- public void setNamespaces() throws XMLStreamException {
- fWriter.setPrefix(PREFIX_ATOM, Constants.NAMESPACE_ATOM);
- fWriter.setPrefix(PREFIX_CMIS, Constants.NAMESPACE_CMIS);
- fWriter.setPrefix(PREFIX_RESTATOM, Constants.NAMESPACE_RESTATOM);
- fWriter.setPrefix(PREFIX_APP, Constants.NAMESPACE_APP);
- fWriter.setPrefix(PREFIX_XSI, Constants.NAMESPACE_XSI);
- }
-
- /**
- * Writes the namespace declaration of the given URI to the current tag.
- */
- public void writeNamespace(String namespaceUri) throws XMLStreamException {
- fWriter.writeNamespace(fWriter.getPrefix(namespaceUri), namespaceUri);
- }
-
- /**
- * Starts the document and sets the namespaces.
- */
- public void startDocument(OutputStream out) throws XMLStreamException {
- // create a writer
- XMLOutputFactory factory = XMLOutputFactory.newInstance();
- fWriter = factory.createXMLStreamWriter(out);
-
- // start the document
- fWriter.writeStartDocument();
- setNamespaces();
- }
-
- /**
- * Finishes the document.
- */
- public void endDocument() throws XMLStreamException {
- if (fWriter == null) {
- return;
- }
-
- // end the document
- fWriter.writeEndDocument();
-
- // we are done.
- fWriter.close();
- }
-
- /**
- * Returns the writer object.
- */
- public XMLStreamWriter getWriter() {
- return fWriter;
- }
-
- /**
- * Sets the writer object.
- */
- protected void setWriter(XMLStreamWriter writer) {
- fWriter = writer;
- }
+ public static final String PREFIX_ATOM = "atom";
+ public static final String PREFIX_CMIS = "cmis";
+ public static final String PREFIX_RESTATOM = "cmisra";
+ public static final String PREFIX_APP = "app";
+ public static final String PREFIX_XSI = "xsi";
+
+ private XMLStreamWriter fWriter;
+
+ /**
+ * Sets the namespaces for the document.
+ */
+ public void setNamespaces() throws XMLStreamException {
+ fWriter.setPrefix(PREFIX_ATOM, Constants.NAMESPACE_ATOM);
+ fWriter.setPrefix(PREFIX_CMIS, Constants.NAMESPACE_CMIS);
+ fWriter.setPrefix(PREFIX_RESTATOM, Constants.NAMESPACE_RESTATOM);
+ fWriter.setPrefix(PREFIX_APP, Constants.NAMESPACE_APP);
+ fWriter.setPrefix(PREFIX_XSI, Constants.NAMESPACE_XSI);
+ }
+
+ /**
+ * Writes the namespace declaration of the given URI to the current tag.
+ */
+ public void writeNamespace(String namespaceUri) throws XMLStreamException {
+ fWriter.writeNamespace(fWriter.getPrefix(namespaceUri), namespaceUri);
+ }
+
+ /**
+ * Starts the document and sets the namespaces.
+ */
+ public void startDocument(OutputStream out) throws XMLStreamException {
+ // create a writer
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ fWriter = factory.createXMLStreamWriter(out);
+
+ // start the document
+ fWriter.writeStartDocument();
+ setNamespaces();
+ }
+
+ /**
+ * Finishes the document.
+ */
+ public void endDocument() throws XMLStreamException {
+ if (fWriter == null) {
+ return;
+ }
+
+ // end the document
+ fWriter.writeEndDocument();
+
+ // we are done.
+ fWriter.close();
+ }
+
+ /**
+ * Returns the writer object.
+ */
+ public XMLStreamWriter getWriter() {
+ return fWriter;
+ }
+
+ /**
+ * Sets the writer object.
+ */
+ protected void setWriter(XMLStreamWriter writer) {
+ fWriter = writer;
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyRepositoryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyRepositoryService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyRepositoryService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyRepositoryService.java Fri Apr 16 14:14:00 2010
@@ -41,51 +41,49 @@ import org.apache.chemistry.opencmis.ser
*/
public class DummyRepositoryService implements CmisRepositoryService {
- private RepositoryInfoImpl fRepInfo;
+ private RepositoryInfoImpl fRepInfo;
- public DummyRepositoryService(String id, String name) {
- fRepInfo = new RepositoryInfoImpl();
+ public DummyRepositoryService(String id, String name) {
+ fRepInfo = new RepositoryInfoImpl();
- fRepInfo.setRepositoryId(id);
- fRepInfo.setRepositoryName(name);
- fRepInfo.setRepositoryDescription(name);
- fRepInfo.setCmisVersionSupported("1.0");
- fRepInfo.setRootFolder("root");
-
- fRepInfo.setVendorName("OpenCMIS");
- fRepInfo.setProductName("OpenCMIS Server");
- fRepInfo.setProductVersion("1.0");
- }
-
- public RepositoryInfo getRepositoryInfo(CallContext context, String repositoryId,
- ExtensionsData extension) {
-
- if (!fRepInfo.getId().equals(repositoryId)) {
- throw new CmisObjectNotFoundException("A repository with repository id '" + repositoryId
- + "' does not exist!");
- }
-
- return fRepInfo;
- }
-
- public List<RepositoryInfo> getRepositoryInfos(CallContext context, ExtensionsData extension) {
- return Collections.singletonList((RepositoryInfo) fRepInfo);
- }
-
- public TypeDefinitionList getTypeChildren(CallContext context, String repositoryId,
- String typeId, Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount,
- ExtensionsData extension) {
- throw new CmisNotSupportedException();
- }
-
- public TypeDefinition getTypeDefinition(CallContext context, String repositoryId, String typeId,
- ExtensionsData extension) {
- throw new CmisNotSupportedException();
- }
-
- public List<TypeDefinitionContainer> getTypeDescendants(CallContext context, String repositoryId,
- String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) {
- throw new CmisNotSupportedException();
- }
+ fRepInfo.setRepositoryId(id);
+ fRepInfo.setRepositoryName(name);
+ fRepInfo.setRepositoryDescription(name);
+ fRepInfo.setCmisVersionSupported("1.0");
+ fRepInfo.setRootFolder("root");
+
+ fRepInfo.setVendorName("OpenCMIS");
+ fRepInfo.setProductName("OpenCMIS Server");
+ fRepInfo.setProductVersion("1.0");
+ }
+
+ public RepositoryInfo getRepositoryInfo(CallContext context, String repositoryId, ExtensionsData extension) {
+
+ if (!fRepInfo.getId().equals(repositoryId)) {
+ throw new CmisObjectNotFoundException("A repository with repository id '" + repositoryId
+ + "' does not exist!");
+ }
+
+ return fRepInfo;
+ }
+
+ public List<RepositoryInfo> getRepositoryInfos(CallContext context, ExtensionsData extension) {
+ return Collections.singletonList((RepositoryInfo) fRepInfo);
+ }
+
+ public TypeDefinitionList getTypeChildren(CallContext context, String repositoryId, String typeId,
+ Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ throw new CmisNotSupportedException();
+ }
+
+ public TypeDefinition getTypeDefinition(CallContext context, String repositoryId, String typeId,
+ ExtensionsData extension) {
+ throw new CmisNotSupportedException();
+ }
+
+ public List<TypeDefinitionContainer> getTypeDescendants(CallContext context, String repositoryId, String typeId,
+ BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) {
+ throw new CmisNotSupportedException();
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java Fri Apr 16 14:14:00 2010
@@ -33,46 +33,46 @@ import org.apache.commons.logging.LogFac
*/
public class DummyServicesFactory extends AbstractServicesFactory {
- private static final String REPOSITORY_ID = "repository.id";
- private static final String REPOSITORY_ID_DEFAULT = "test-rep";
+ private static final String REPOSITORY_ID = "repository.id";
+ private static final String REPOSITORY_ID_DEFAULT = "test-rep";
- private static final String REPOSITORY_NAME = "repository.name";
- private static final String REPOSITORY_NAME_DEFAULT = "Test Repository";
+ private static final String REPOSITORY_NAME = "repository.name";
+ private static final String REPOSITORY_NAME_DEFAULT = "Test Repository";
- private static final Log LOG = LogFactory.getLog(DummyServicesFactory.class.getName());
+ private static final Log LOG = LogFactory.getLog(DummyServicesFactory.class.getName());
- private DummyRepositoryService fRepositoryService;
- private String fId;
- private String fName;
-
- @Override
- public void init(Map<String, String> parameters) {
- // get the id
- fId = parameters.get(REPOSITORY_ID);
- if ((fId == null) || (fId.trim().length() == 0)) {
- fId = REPOSITORY_ID_DEFAULT;
- }
-
- // get the name
- fName = parameters.get(REPOSITORY_NAME);
- if ((fName == null) || (fName.trim().length() == 0)) {
- fName = REPOSITORY_NAME_DEFAULT;
- }
-
- // create a repository service
- fRepositoryService = new DummyRepositoryService(fId, fName);
-
- LOG.info("Initialized dummy repository '" + fName + "' (" + fId + ")");
- }
-
- @Override
- public void destroy() {
- LOG.info("Destroyed dummy repository '" + fName + "' (" + fId + ")");
- }
-
- @Override
- public CmisRepositoryService getRepositoryService() {
- return fRepositoryService;
- }
+ private DummyRepositoryService fRepositoryService;
+ private String fId;
+ private String fName;
+
+ @Override
+ public void init(Map<String, String> parameters) {
+ // get the id
+ fId = parameters.get(REPOSITORY_ID);
+ if ((fId == null) || (fId.trim().length() == 0)) {
+ fId = REPOSITORY_ID_DEFAULT;
+ }
+
+ // get the name
+ fName = parameters.get(REPOSITORY_NAME);
+ if ((fName == null) || (fName.trim().length() == 0)) {
+ fName = REPOSITORY_NAME_DEFAULT;
+ }
+
+ // create a repository service
+ fRepositoryService = new DummyRepositoryService(fId, fName);
+
+ LOG.info("Initialized dummy repository '" + fName + "' (" + fId + ")");
+ }
+
+ @Override
+ public void destroy() {
+ LOG.info("Destroyed dummy repository '" + fName + "' (" + fId + ")");
+ }
+
+ @Override
+ public CmisRepositoryService getRepositoryService() {
+ return fRepositoryService;
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java Fri Apr 16 14:14:00 2010
@@ -54,91 +54,79 @@ import org.apache.chemistry.opencmis.ser
*/
public abstract class AbstractService {
- public static final String CALL_CONTEXT_MAP = "org.apache.chemistry.opencmis.callcontext";
+ public static final String CALL_CONTEXT_MAP = "org.apache.chemistry.opencmis.callcontext";
- /**
- * Returns the services factory.
- */
- protected AbstractServicesFactory getServicesFactory(WebServiceContext wsContext) {
- ServletContext servletContext = (ServletContext) wsContext.getMessageContext().get(
- MessageContext.SERVLET_CONTEXT);
-
- return (AbstractServicesFactory) servletContext
- .getAttribute(CmisRepositoryContextListener.SERVICES_FACTORY);
- }
-
- /**
- * Creates a CallContext object for the Web Service context.
- */
- @SuppressWarnings("unchecked")
- protected CallContext createContext(WebServiceContext wsContext) {
- CallContextImpl context = new CallContextImpl(CallContext.BINDING_WEBSERVICES);
-
- MessageContext mc = wsContext.getMessageContext();
- Map<String, String> callContextMap = (Map<String, String>) mc.get(CALL_CONTEXT_MAP);
- if (callContextMap != null) {
- for (Map.Entry<String, String> e : callContextMap.entrySet()) {
- context.put(e.getKey(), e.getValue());
- }
- }
-
- return context;
- }
-
- /**
- * Converts a CMIS exception to the appropriate Web Service exception.
- */
- protected CmisException convertException(Exception ex) {
- CmisFaultType fault = new CmisFaultType();
- fault.setMessage("Unknown exception");
- fault.setCode(BigInteger.ZERO);
- fault.setType(EnumServiceException.RUNTIME);
-
- if (ex != null) {
- fault.setMessage(ex.getMessage());
-
- if (ex instanceof CmisBaseException) {
- fault.setCode(((CmisBaseException) ex).getCode());
- }
-
- if (ex instanceof CmisConstraintException) {
- fault.setType(EnumServiceException.CONSTRAINT);
- }
- else if (ex instanceof CmisContentAlreadyExistsException) {
- fault.setType(EnumServiceException.CONTENT_ALREADY_EXISTS);
- }
- else if (ex instanceof CmisFilterNotValidException) {
- fault.setType(EnumServiceException.FILTER_NOT_VALID);
- }
- else if (ex instanceof CmisInvalidArgumentException) {
- fault.setType(EnumServiceException.INVALID_ARGUMENT);
- }
- else if (ex instanceof CmisNameConstraintViolationException) {
- fault.setType(EnumServiceException.NAME_CONSTRAINT_VIOLATION);
- }
- else if (ex instanceof CmisNotSupportedException) {
- fault.setType(EnumServiceException.NOT_SUPPORTED);
- }
- else if (ex instanceof CmisObjectNotFoundException) {
- fault.setType(EnumServiceException.OBJECT_NOT_FOUND);
- }
- else if (ex instanceof CmisPermissionDeniedException) {
- fault.setType(EnumServiceException.PERMISSION_DENIED);
- }
- else if (ex instanceof CmisStorageException) {
- fault.setType(EnumServiceException.STORAGE);
- }
- else if (ex instanceof CmisStreamNotSupportedException) {
- fault.setType(EnumServiceException.STREAM_NOT_SUPPORTED);
- }
- else if (ex instanceof CmisUpdateConflictException) {
- fault.setType(EnumServiceException.UPDATE_CONFLICT);
- }
- else if (ex instanceof CmisVersioningException) {
- fault.setType(EnumServiceException.VERSIONING);
- }
- }
+ /**
+ * Returns the services factory.
+ */
+ protected AbstractServicesFactory getServicesFactory(WebServiceContext wsContext) {
+ ServletContext servletContext = (ServletContext) wsContext.getMessageContext().get(
+ MessageContext.SERVLET_CONTEXT);
+
+ return (AbstractServicesFactory) servletContext.getAttribute(CmisRepositoryContextListener.SERVICES_FACTORY);
+ }
+
+ /**
+ * Creates a CallContext object for the Web Service context.
+ */
+ @SuppressWarnings("unchecked")
+ protected CallContext createContext(WebServiceContext wsContext) {
+ CallContextImpl context = new CallContextImpl(CallContext.BINDING_WEBSERVICES);
+
+ MessageContext mc = wsContext.getMessageContext();
+ Map<String, String> callContextMap = (Map<String, String>) mc.get(CALL_CONTEXT_MAP);
+ if (callContextMap != null) {
+ for (Map.Entry<String, String> e : callContextMap.entrySet()) {
+ context.put(e.getKey(), e.getValue());
+ }
+ }
+
+ return context;
+ }
+
+ /**
+ * Converts a CMIS exception to the appropriate Web Service exception.
+ */
+ protected CmisException convertException(Exception ex) {
+ CmisFaultType fault = new CmisFaultType();
+ fault.setMessage("Unknown exception");
+ fault.setCode(BigInteger.ZERO);
+ fault.setType(EnumServiceException.RUNTIME);
+
+ if (ex != null) {
+ fault.setMessage(ex.getMessage());
+
+ if (ex instanceof CmisBaseException) {
+ fault.setCode(((CmisBaseException) ex).getCode());
+ }
+
+ if (ex instanceof CmisConstraintException) {
+ fault.setType(EnumServiceException.CONSTRAINT);
+ } else if (ex instanceof CmisContentAlreadyExistsException) {
+ fault.setType(EnumServiceException.CONTENT_ALREADY_EXISTS);
+ } else if (ex instanceof CmisFilterNotValidException) {
+ fault.setType(EnumServiceException.FILTER_NOT_VALID);
+ } else if (ex instanceof CmisInvalidArgumentException) {
+ fault.setType(EnumServiceException.INVALID_ARGUMENT);
+ } else if (ex instanceof CmisNameConstraintViolationException) {
+ fault.setType(EnumServiceException.NAME_CONSTRAINT_VIOLATION);
+ } else if (ex instanceof CmisNotSupportedException) {
+ fault.setType(EnumServiceException.NOT_SUPPORTED);
+ } else if (ex instanceof CmisObjectNotFoundException) {
+ fault.setType(EnumServiceException.OBJECT_NOT_FOUND);
+ } else if (ex instanceof CmisPermissionDeniedException) {
+ fault.setType(EnumServiceException.PERMISSION_DENIED);
+ } else if (ex instanceof CmisStorageException) {
+ fault.setType(EnumServiceException.STORAGE);
+ } else if (ex instanceof CmisStreamNotSupportedException) {
+ fault.setType(EnumServiceException.STREAM_NOT_SUPPORTED);
+ } else if (ex instanceof CmisUpdateConflictException) {
+ fault.setType(EnumServiceException.UPDATE_CONFLICT);
+ } else if (ex instanceof CmisVersioningException) {
+ fault.setType(EnumServiceException.VERSIONING);
+ }
+ }
- return new CmisException(fault.getMessage(), fault, ex);
- }
+ return new CmisException(fault.getMessage(), fault, ex);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java Fri Apr 16 14:14:00 2010
@@ -44,59 +44,55 @@ import org.apache.chemistry.opencmis.ser
*/
@WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort")
public class AclService extends AbstractService implements ACLServicePort {
- @Resource
- WebServiceContext fContext;
+ @Resource
+ WebServiceContext fContext;
- public CmisACLType applyACL(String repositoryId, String objectId,
- CmisAccessControlListType addAces, CmisAccessControlListType removeAces,
- EnumACLPropagation aclPropagation, CmisExtensionType extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisAclService service = factory.getAclService();
- CallContext context = createContext(fContext);
-
- Acl acl = service.applyAcl(context, repositoryId, objectId, convert(addAces,
- null), convert(removeAces, null), convert(AclPropagation.class, aclPropagation),
- convert(extension));
-
- if (acl == null) {
- return null;
- }
-
- CmisACLType result = new CmisACLType();
- result.setACL(convert(acl));
- result.setExact(acl.isExact());
-
- return result;
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- public CmisACLType getACL(String repositoryId, String objectId, Boolean onlyBasicPermissions,
- CmisExtensionType extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisAclService service = factory.getAclService();
- CallContext context = createContext(fContext);
-
- Acl acl = service.getAcl(context, repositoryId, objectId, onlyBasicPermissions,
- convert(extension));
-
- if (acl == null) {
- return null;
- }
-
- CmisACLType result = new CmisACLType();
- result.setACL(convert(acl));
- result.setExact(acl.isExact());
-
- return result;
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
+ public CmisACLType applyACL(String repositoryId, String objectId, CmisAccessControlListType addAces,
+ CmisAccessControlListType removeAces, EnumACLPropagation aclPropagation, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisAclService service = factory.getAclService();
+ CallContext context = createContext(fContext);
+
+ Acl acl = service.applyAcl(context, repositoryId, objectId, convert(addAces, null), convert(removeAces,
+ null), convert(AclPropagation.class, aclPropagation), convert(extension));
+
+ if (acl == null) {
+ return null;
+ }
+
+ CmisACLType result = new CmisACLType();
+ result.setACL(convert(acl));
+ result.setExact(acl.isExact());
+
+ return result;
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisACLType getACL(String repositoryId, String objectId, Boolean onlyBasicPermissions,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisAclService service = factory.getAclService();
+ CallContext context = createContext(fContext);
+
+ Acl acl = service.getAcl(context, repositoryId, objectId, onlyBasicPermissions, convert(extension));
+
+ if (acl == null) {
+ return null;
+ }
+
+ CmisACLType result = new CmisACLType();
+ result.setACL(convert(acl));
+ result.setExact(acl.isExact());
+
+ return result;
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AuthHandler.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AuthHandler.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AuthHandler.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AuthHandler.java Fri Apr 16 14:14:00 2010
@@ -42,59 +42,56 @@ import org.apache.chemistry.opencmis.ser
*/
public class AuthHandler implements SOAPHandler<SOAPMessageContext> {
- private static final String WSSE_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
- private static final QName WSSE_SECURITY = new QName(WSSE_NS, "Security");
- private static final QName WSSE_USERNAME_TOKEN = new QName(WSSE_NS, "UsernameToken");
- private static final QName WSSE_USERNAME = new QName(WSSE_NS, "Username");
- private static final QName WSSE_PASSWORD = new QName(WSSE_NS, "Password");
-
- private static final Set<QName> HEADERS = new HashSet<QName>();
- static {
- HEADERS.add(WSSE_SECURITY);
- }
-
- public Set<QName> getHeaders() {
- return HEADERS;
- }
-
- public void close(MessageContext context) {
- }
-
- public boolean handleFault(SOAPMessageContext context) {
- return true;
- }
-
- public boolean handleMessage(SOAPMessageContext context) {
- Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- if (outboundProperty.booleanValue()) {
- // we are only looking at inbound messages
- return true;
- }
-
- try {
- // read the header
- SOAPMessage msg = context.getMessage();
- SOAPHeader sh = msg.getSOAPHeader();
- SOAPElement securityElement = (SOAPElement) sh.getChildElements(WSSE_SECURITY).next();
- SOAPElement tokenElement = (SOAPElement) securityElement
- .getChildElements(WSSE_USERNAME_TOKEN).next();
- SOAPElement userElement = (SOAPElement) tokenElement.getChildElements(WSSE_USERNAME).next();
- SOAPElement passwordElement = (SOAPElement) tokenElement.getChildElements(WSSE_PASSWORD)
- .next();
-
- // add user and password to context
- Map<String, String> callContextMap = new HashMap<String, String>();
- callContextMap.put(CallContext.USERNAME, userElement.getValue());
- callContextMap.put(CallContext.PASSWORD, passwordElement.getValue());
-
- context.put(AbstractService.CALL_CONTEXT_MAP, callContextMap);
- context.setScope(AbstractService.CALL_CONTEXT_MAP, Scope.APPLICATION);
- }
- catch (Exception e) {
- // something went wrong, e.g. a part of the SOAP header wasn't set
- throw new RuntimeException("UsernameToken not set!", e);
- }
+ private static final String WSSE_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+ private static final QName WSSE_SECURITY = new QName(WSSE_NS, "Security");
+ private static final QName WSSE_USERNAME_TOKEN = new QName(WSSE_NS, "UsernameToken");
+ private static final QName WSSE_USERNAME = new QName(WSSE_NS, "Username");
+ private static final QName WSSE_PASSWORD = new QName(WSSE_NS, "Password");
+
+ private static final Set<QName> HEADERS = new HashSet<QName>();
+ static {
+ HEADERS.add(WSSE_SECURITY);
+ }
+
+ public Set<QName> getHeaders() {
+ return HEADERS;
+ }
+
+ public void close(MessageContext context) {
+ }
+
+ public boolean handleFault(SOAPMessageContext context) {
+ return true;
+ }
+
+ public boolean handleMessage(SOAPMessageContext context) {
+ Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ if (outboundProperty.booleanValue()) {
+ // we are only looking at inbound messages
+ return true;
+ }
+
+ try {
+ // read the header
+ SOAPMessage msg = context.getMessage();
+ SOAPHeader sh = msg.getSOAPHeader();
+ SOAPElement securityElement = (SOAPElement) sh.getChildElements(WSSE_SECURITY).next();
+ SOAPElement tokenElement = (SOAPElement) securityElement.getChildElements(WSSE_USERNAME_TOKEN).next();
+ SOAPElement userElement = (SOAPElement) tokenElement.getChildElements(WSSE_USERNAME).next();
+ SOAPElement passwordElement = (SOAPElement) tokenElement.getChildElements(WSSE_PASSWORD).next();
+
+ // add user and password to context
+ Map<String, String> callContextMap = new HashMap<String, String>();
+ callContextMap.put(CallContext.USERNAME, userElement.getValue());
+ callContextMap.put(CallContext.PASSWORD, passwordElement.getValue());
+
+ context.put(AbstractService.CALL_CONTEXT_MAP, callContextMap);
+ context.setScope(AbstractService.CALL_CONTEXT_MAP, Scope.APPLICATION);
+ } catch (Exception e) {
+ // something went wrong, e.g. a part of the SOAP header wasn't set
+ throw new RuntimeException("UsernameToken not set!", e);
+ }
- return true;
- }
+ return true;
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java Fri Apr 16 14:14:00 2010
@@ -48,51 +48,46 @@ import org.apache.chemistry.opencmis.ser
*/
@WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort")
public class DiscoveryService extends AbstractService implements DiscoveryServicePort {
- @Resource
- WebServiceContext fContext;
+ @Resource
+ WebServiceContext fContext;
- public void getContentChanges(String repositoryId, Holder<String> changeLogToken,
- Boolean includeProperties, String filter, Boolean includePolicyIds, Boolean includeAcl,
- BigInteger maxItems, CmisExtensionType extension, Holder<CmisObjectListType> objects)
- throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisDiscoveryService service = factory.getDiscoveryService();
- CallContext context = createContext(fContext);
-
- org.apache.chemistry.opencmis.commons.api.Holder<String> changeLogTokenHolder = convertHolder(changeLogToken);
-
- ObjectList changesList = service.getContentChanges(context, repositoryId,
- changeLogTokenHolder, includeProperties, filter, includePolicyIds, includeAcl, maxItems,
- convert(extension), null);
-
- if (objects != null) {
- objects.value = convert(changesList);
- }
-
- setHolderValue(changeLogTokenHolder, changeLogToken);
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- public CmisObjectListType query(String repositoryId, String statement, Boolean searchAllVersions,
- Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
- String renditionFilter, BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension)
- throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisDiscoveryService service = factory.getDiscoveryService();
- CallContext context = createContext(fContext);
-
- return convert(service.query(context, repositoryId, statement, searchAllVersions,
- includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
- renditionFilter, maxItems, skipCount, convert(extension)));
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
+ public void getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
+ String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems,
+ CmisExtensionType extension, Holder<CmisObjectListType> objects) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisDiscoveryService service = factory.getDiscoveryService();
+ CallContext context = createContext(fContext);
+
+ org.apache.chemistry.opencmis.commons.api.Holder<String> changeLogTokenHolder = convertHolder(changeLogToken);
+
+ ObjectList changesList = service.getContentChanges(context, repositoryId, changeLogTokenHolder,
+ includeProperties, filter, includePolicyIds, includeAcl, maxItems, convert(extension), null);
+
+ if (objects != null) {
+ objects.value = convert(changesList);
+ }
+
+ setHolderValue(changeLogTokenHolder, changeLogToken);
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisObjectListType query(String repositoryId, String statement, Boolean searchAllVersions,
+ Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
+ BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisDiscoveryService service = factory.getDiscoveryService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.query(context, repositoryId, statement, searchAllVersions, includeAllowableActions,
+ convert(IncludeRelationships.class, includeRelationships), renditionFilter, maxItems, skipCount,
+ convert(extension)));
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java Fri Apr 16 14:14:00 2010
@@ -42,44 +42,41 @@ import org.apache.chemistry.opencmis.ser
*/
@WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.MultiFilingServicePort")
public class MultiFilingService extends AbstractService implements MultiFilingServicePort {
- @Resource
- WebServiceContext fContext;
+ @Resource
+ WebServiceContext fContext;
- public void addObjectToFolder(String repositoryId, String objectId, String folderId,
- Boolean allVersions, Holder<CmisExtensionType> extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisMultiFilingService service = factory.getMultiFilingService();
- CallContext context = createContext(fContext);
-
- ExtensionsData extData = convertExtensionHolder(extension);
-
- service.addObjectToFolder(context, repositoryId, objectId, folderId, allVersions, extData,
- null);
-
- setExtensionValues(extData, extension);
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- public void removeObjectFromFolder(String repositoryId, String objectId, String folderId,
- Holder<CmisExtensionType> extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisMultiFilingService service = factory.getMultiFilingService();
- CallContext context = createContext(fContext);
-
- ExtensionsData extData = convertExtensionHolder(extension);
-
- service.removeObjectFromFolder(context, repositoryId, objectId, folderId, extData, null);
-
- setExtensionValues(extData, extension);
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
+ public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
+ Holder<CmisExtensionType> extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisMultiFilingService service = factory.getMultiFilingService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.addObjectToFolder(context, repositoryId, objectId, folderId, allVersions, extData, null);
+
+ setExtensionValues(extData, extension);
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void removeObjectFromFolder(String repositoryId, String objectId, String folderId,
+ Holder<CmisExtensionType> extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisMultiFilingService service = factory.getMultiFilingService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.removeObjectFromFolder(context, repositoryId, objectId, folderId, extData, null);
+
+ setExtensionValues(extData, extension);
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java?rev=934896&r1=934895&r2=934896&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java Fri Apr 16 14:14:00 2010
@@ -52,143 +52,130 @@ import org.apache.chemistry.opencmis.ser
*/
@WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.NavigationServicePort")
public class NavigationService extends AbstractService implements NavigationServicePort {
- @Resource
- WebServiceContext fContext;
+ @Resource
+ WebServiceContext fContext;
- public CmisObjectListType getCheckedOutDocs(String repositoryId, String folderId, String filter,
- String orderBy, Boolean includeAllowableActions,
- EnumIncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems,
- BigInteger skipCount, CmisExtensionType extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisNavigationService service = factory.getNavigationService();
- CallContext context = createContext(fContext);
-
- return convert(service.getCheckedOutDocs(context, repositoryId, folderId, filter, orderBy,
- includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
- renditionFilter, maxItems, skipCount, convert(extension), null));
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- public CmisObjectInFolderListType getChildren(String repositoryId, String folderId,
- String filter, String orderBy, Boolean includeAllowableActions,
- EnumIncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
- CmisExtensionType extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisNavigationService service = factory.getNavigationService();
- CallContext context = createContext(fContext);
-
- return convert(service.getChildren(context, repositoryId, folderId, filter, orderBy,
- includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
- renditionFilter, includePathSegment, maxItems, skipCount, convert(extension), null));
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- public List<CmisObjectInFolderContainerType> getDescendants(String repositoryId, String folderId,
- BigInteger depth, String filter, Boolean includeAllowableActions,
- EnumIncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, CmisExtensionType extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisNavigationService service = factory.getNavigationService();
- CallContext context = createContext(fContext);
-
- List<CmisObjectInFolderContainerType> result = new ArrayList<CmisObjectInFolderContainerType>();
-
- List<ObjectInFolderContainer> serviceResult = service.getDescendants(context, repositoryId,
- folderId, depth, filter, includeAllowableActions, convert(IncludeRelationships.class,
- includeRelationships), renditionFilter, includePathSegment, convert(extension), null);
-
- if (serviceResult != null) {
- for (ObjectInFolderContainer container : serviceResult) {
- result.add(convert(container));
- }
- }
-
- return result;
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- public CmisObjectType getFolderParent(String repositoryId, String folderId, String filter,
- CmisExtensionType extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisNavigationService service = factory.getNavigationService();
- CallContext context = createContext(fContext);
-
- return convert(service.getFolderParent(context, repositoryId, folderId, filter,
- convert(extension), null));
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- public List<CmisObjectInFolderContainerType> getFolderTree(String repositoryId, String folderId,
- BigInteger depth, String filter, Boolean includeAllowableActions,
- EnumIncludeRelationships includeRelationships, String renditionFilter,
- Boolean includePathSegment, CmisExtensionType extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisNavigationService service = factory.getNavigationService();
- CallContext context = createContext(fContext);
-
- List<CmisObjectInFolderContainerType> result = new ArrayList<CmisObjectInFolderContainerType>();
-
- List<ObjectInFolderContainer> serviceResult = service.getFolderTree(context, repositoryId,
- folderId, depth, filter, includeAllowableActions, convert(IncludeRelationships.class,
- includeRelationships), renditionFilter, includePathSegment, convert(extension), null);
-
- if (serviceResult != null) {
- for (ObjectInFolderContainer container : serviceResult) {
- result.add(convert(container));
- }
- }
-
- return result;
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- public List<CmisObjectParentsType> getObjectParents(String repositoryId, String objectId,
- String filter, Boolean includeAllowableActions,
- EnumIncludeRelationships includeRelationships, String renditionFilter,
- Boolean includeRelativePathSegment, CmisExtensionType extension) throws CmisException {
- try {
- AbstractServicesFactory factory = getServicesFactory(fContext);
- CmisNavigationService service = factory.getNavigationService();
- CallContext context = createContext(fContext);
-
- List<CmisObjectParentsType> result = new ArrayList<CmisObjectParentsType>();
-
- List<ObjectParentData> serviceResult = service.getObjectParents(context, repositoryId,
- objectId, filter, includeAllowableActions, convert(IncludeRelationships.class,
- includeRelationships), renditionFilter, includeRelativePathSegment,
- convert(extension), null);
-
- if (serviceResult != null) {
- for (ObjectParentData parent : serviceResult) {
- result.add(convert(parent));
- }
- }
-
- return result;
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
+ public CmisObjectListType getCheckedOutDocs(String repositoryId, String folderId, String filter, String orderBy,
+ Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
+ BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getCheckedOutDocs(context, repositoryId, folderId, filter, orderBy,
+ includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+ renditionFilter, maxItems, skipCount, convert(extension), null));
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisObjectInFolderListType getChildren(String repositoryId, String folderId, String filter, String orderBy,
+ Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getChildren(context, repositoryId, folderId, filter, orderBy,
+ includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+ renditionFilter, includePathSegment, maxItems, skipCount, convert(extension), null));
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisObjectInFolderContainerType> getDescendants(String repositoryId, String folderId, BigInteger depth,
+ String filter, Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePathSegment, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ List<CmisObjectInFolderContainerType> result = new ArrayList<CmisObjectInFolderContainerType>();
+
+ List<ObjectInFolderContainer> serviceResult = service.getDescendants(context, repositoryId, folderId,
+ depth, filter, includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+ renditionFilter, includePathSegment, convert(extension), null);
+
+ if (serviceResult != null) {
+ for (ObjectInFolderContainer container : serviceResult) {
+ result.add(convert(container));
+ }
+ }
+
+ return result;
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisObjectType getFolderParent(String repositoryId, String folderId, String filter,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getFolderParent(context, repositoryId, folderId, filter, convert(extension), null));
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisObjectInFolderContainerType> getFolderTree(String repositoryId, String folderId, BigInteger depth,
+ String filter, Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePathSegment, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ List<CmisObjectInFolderContainerType> result = new ArrayList<CmisObjectInFolderContainerType>();
+
+ List<ObjectInFolderContainer> serviceResult = service.getFolderTree(context, repositoryId, folderId, depth,
+ filter, includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+ renditionFilter, includePathSegment, convert(extension), null);
+
+ if (serviceResult != null) {
+ for (ObjectInFolderContainer container : serviceResult) {
+ result.add(convert(container));
+ }
+ }
+
+ return result;
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisObjectParentsType> getObjectParents(String repositoryId, String objectId, String filter,
+ Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includeRelativePathSegment, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ List<CmisObjectParentsType> result = new ArrayList<CmisObjectParentsType>();
+
+ List<ObjectParentData> serviceResult = service.getObjectParents(context, repositoryId, objectId, filter,
+ includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+ renditionFilter, includeRelativePathSegment, convert(extension), null);
+
+ if (serviceResult != null) {
+ for (ObjectParentData parent : serviceResult) {
+ result.add(convert(parent));
+ }
+ }
+
+ return result;
+ } catch (Exception e) {
+ throw convertException(e);
+ }
+ }
}