Files
alfresco-community-repo/source/java/org/alfresco/opencmis/AlfrescoCmisServiceFactory.java
Alan Davis 2789661377 Merged 5.2.N-SERVLET-3.0 (5.2.1) to 5.2.N (5.2.1)
131490: REPO-1238 / REPO-1413: Use data-model with the OpenCMIS upgrade.,
   131493: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0.
       - Compilation errors fixed
       - Removed old JAX-WS listener from web.xml + sun-jaxws.xml - obsolete after the upgrade (OpenCMIS has replaced JAX-WS with Apache CXF)
       - Set chemistry-opencmis-test-browser version to 0.14.0, since it was removed in 1.0.0 (TODO: see if something from 1.0.0 can be used instead)
       - Changed dependency on XmlSchema 1.4.7 to xmlschema-core 2.2.1 (required by Apache CXF) - implications of this change still to be addressed.,
   131569: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0.
       - Possible fix for the browser binding - since OpenCMIS 0.13.0, repository URLs always require a cmisselector parameter (see CMIS-893).,
   131671: REPO-843 Upgrade our Servlet API usage to 3.0.1 (from 2.4 / 2.5)
      - Modifications to weblogic-application.xml to allow Weblogic 12.2.1.1 to start with the changes
        made so far for the 1.0 Open CMIS upgrade (REPO-1238). This follows the Servlet 3.0 upgrade
        which resulted in WebLogic not starting. The Open CMIS upgrade has helped with fixing the WebLogic
        start up issue, however...
      - Some of the changes are TEMPORARY to pick up classes and resources from either the JRE or WebLogic
        rather than the alfresco.war. These should be coming from the alfresco.war, but we will still need to
        upgrade the jars that we package. See comments being added to REPO-1413 related to the CMIS upgrade.
      - It is likely that there are other entries in this file that are not needed.,
   131758: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Fix for CMISTCKVersioning tests.
       - The VersioningSmokeTest from the OpenCMIS TCK has been enhanced with the case of checking-in documents with new properties (not just new content). This touches the part of code in CMISConnector that parses the secondary types (aspects), removes the old ones and adds the new. The problem was that even the working copy aspect was removed for checked out documents. This is illegal and an error was thrown.
       - Applies to CMIS 1.1.,
   131815: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Fix for CMISTCKVersioning tests.
       - The VersioningSmokeTest from the OpenCMIS TCK has been enhanced with the case of checking-in documents with new properties (not just new content). So the tests check-in a document with the same name as the original name causing the rename of the working copy to fail. I added an extra check on the name format for working copies.
       - Applies to CMIS 1.0.,
   131843: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Fix for CMISTCKCRUD tests.
       - The SetAndDeleteContentTest from the OpenCMIS TCK has been enhanced with tests that append content. The case where the content was 0 bytes failed, because of an "unnecessary" (hopefully) check on the content data length.,
   131859: REPO-1413 : Upgrade to OpenCMIS 1.0 - update dependencies and fix compilation and/or build test failures
      - fixed failing testVersioningPropertiesHaveDefaultValue ,
   131868: REPO-1413 : Upgrade to OpenCMIS 1.0 - update dependencies and fix compilation and/or build test failures
      - fixed new failing tests,
   131876: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0
       - Fix for versioning related tests.,
   131907: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0
       - Removed unused dependency on chemistry-opencmis-test-browser,
   132064: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0
       - Removed unnecessary excludes, updated data-model, added junit dependency for legacy-lucene which was relying on a now unused dependency to get the junit.,
   132069: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0
       - Upgrade jaxb libraries to 2.2.11, alfresco-core to 6.7.,
   132110: REPO-843 Upgrade our Servlet API usage to 3.0.1 (from 2.4 / 2.5)
      - Further modifications to weblogic-application.xml
        - Checked file only contains references to files that we actually package in alfresco.war.
        - Add additional entries identified by WebLogic's CAT
          - Exclude myfaces-api-1.1.10.jar classes (used by the Explorer UI, removed in 5.0 but still used by Cloud).
          - Exclude classes that cause start up exception. We must use the RT or Weblogic versions.,
   132161: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0
       - code review changes
   132356: Change to using data-model 6.6


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@132357 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2016-11-03 17:28:19 +00:00

186 lines
6.7 KiB
Java

/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.opencmis;
import java.util.Map;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionInterceptor;
import org.alfresco.service.cmr.security.AuthorityService;
import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
import org.apache.chemistry.opencmis.commons.server.CallContext;
import org.apache.chemistry.opencmis.commons.server.CmisService;
import org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aop.framework.ProxyFactory;
/**
* Factory for OpenCMIS service objects.
*
* @author florian.mueller
* @author Derek Hulley
*/
public class AlfrescoCmisServiceFactory extends AbstractServiceFactory
{
private static final Log logger = LogFactory.getLog(AlfrescoCmisServiceFactory.class);
private CMISConnector connector;
private RetryingTransactionInterceptor cmisTransactions;
private AlfrescoCmisExceptionInterceptor cmisExceptions;
private AlfrescoCmisServiceInterceptor cmisControl;
private AlfrescoCmisStreamInterceptor cmisStreams;
private AuthorityService authorityService;
/**
* Sets the Authority Service.
*/
public void setAuthorityService(AuthorityService authorityService)
{
this.authorityService = authorityService;
}
/**
* Sets the CMIS connector.
*/
public void setCmisConnector(CMISConnector connector)
{
this.connector = connector;
}
/**
* @param cmisTransactions the interceptor that applies appropriate transactions
*/
public void setCmisTransactions(RetryingTransactionInterceptor cmisTransactions)
{
this.cmisTransactions = cmisTransactions;
}
/**
* @param cmisExceptions interceptor to translate exceptions
*/
public void setCmisExceptions(AlfrescoCmisExceptionInterceptor cmisExceptions)
{
this.cmisExceptions = cmisExceptions;
}
/**
* @param cmisControl interceptor that provides logging and authentication checks
*/
public void setCmisControl(AlfrescoCmisServiceInterceptor cmisControl)
{
this.cmisControl = cmisControl;
}
/**
* @param cmisStreams interceptor to create reusable ContentStreams
*/
public void setCmisStreams(AlfrescoCmisStreamInterceptor cmisStreams)
{
this.cmisStreams = cmisStreams;
}
@Override
public void init(Map<String, String> parameters)
{
}
public void init()
{
// this.service = getCmisServiceTarget(connector);
//
// // Wrap it
// ProxyFactory proxyFactory = new ProxyFactory(service);
// proxyFactory.addInterface(AlfrescoCmisService.class);
// proxyFactory.addAdvice(cmisExceptions);
// proxyFactory.addAdvice(cmisControl);
// proxyFactory.addAdvice(cmisStreams);
// proxyFactory.addAdvice(cmisTransactions);
// AlfrescoCmisService cmisService = (AlfrescoCmisService) proxyFactory.getProxy();
//
// this.serviceWrapper = new CmisServiceWrapper<CmisService>(
// cmisService,
// connector.getTypesDefaultMaxItems(), connector.getTypesDefaultDepth(),
// connector.getObjectsDefaultMaxItems(), connector.getObjectsDefaultDepth());
}
@Override
public void destroy()
{
}
/**
* TODO:
* We are producing new instances each time.
*/
@Override
public CmisService getService(final CallContext context)
{
if (logger.isDebugEnabled())
{
StringBuilder sb = new StringBuilder();
sb.append("getService: ").append(AuthenticationUtil.getFullyAuthenticatedUser())
.append(" [runAsUser=").append(AuthenticationUtil.getRunAsUser())
.append(",ctxUserName=").append(context.getUsername())
.append(",ctxRepoId=").append(context.getRepositoryId()).append("]");
logger.debug(sb.toString());
}
// Avoid using guest user if the user is provided in the context
if(AuthenticationUtil.getFullyAuthenticatedUser() != null && authorityService.isGuestAuthority(AuthenticationUtil.getFullyAuthenticatedUser()))
{
AuthenticationUtil.clearCurrentSecurityContext();
}
AlfrescoCmisService service = getCmisServiceTarget(connector);
// Wrap it
ProxyFactory proxyFactory = new ProxyFactory(service);
proxyFactory.addInterface(AlfrescoCmisService.class);
proxyFactory.addAdvice(cmisExceptions);
proxyFactory.addAdvice(cmisControl);
proxyFactory.addAdvice(cmisStreams);
proxyFactory.addAdvice(cmisTransactions);
AlfrescoCmisService cmisService = (AlfrescoCmisService) proxyFactory.getProxy();
ConformanceCmisServiceWrapper wrapperService = new ConformanceCmisServiceWrapper(
cmisService,
connector.getTypesDefaultMaxItems(), connector.getTypesDefaultDepth(),
connector.getObjectsDefaultMaxItems(), connector.getObjectsDefaultDepth());
// We use our specific open method here because only we know about it
cmisService.open(context);
return wrapperService;
}
protected AlfrescoCmisService getCmisServiceTarget(CMISConnector connector)
{
return new AlfrescoCmisServiceImpl(connector);
}
}