mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge WCM-SERVICES to HEAD
Changes 11272-11536 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11562 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,465 +1,471 @@
|
||||
/*
|
||||
* 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.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.alfresco.mbeans.VirtServerRegistry;
|
||||
import org.alfresco.repo.site.SiteService;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||
import org.alfresco.service.cmr.audit.AuditService;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentService;
|
||||
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
|
||||
import org.alfresco.service.cmr.ml.EditionService;
|
||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.CopyService;
|
||||
import org.alfresco.service.cmr.repository.CrossRepositoryCopyService;
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.ScriptService;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.cmr.search.CategoryService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.OwnableService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
||||
import org.alfresco.service.cmr.version.VersionService;
|
||||
import org.alfresco.service.cmr.view.ExporterService;
|
||||
import org.alfresco.service.cmr.view.ImporterService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of a Service Registry based on the definition of
|
||||
* Services contained within a Spring Bean Factory.
|
||||
*
|
||||
* @author David Caruana
|
||||
*/
|
||||
public class ServiceDescriptorRegistry
|
||||
implements BeanFactoryAware, ServiceRegistry
|
||||
{
|
||||
// Bean Factory within which the registry lives
|
||||
private BeanFactory beanFactory = null;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
|
||||
*/
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
|
||||
{
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getServices()
|
||||
*/
|
||||
public Collection<QName> getServices()
|
||||
{
|
||||
// TODO: Implement
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#isServiceProvided(org.alfresco.repo.ref.QName)
|
||||
*/
|
||||
public boolean isServiceProvided(QName service)
|
||||
{
|
||||
// TODO: Implement
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getService(org.alfresco.repo.ref.QName)
|
||||
*/
|
||||
public Object getService(QName service)
|
||||
{
|
||||
return beanFactory.getBean(service.getLocalName());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getDescriptorService()
|
||||
*/
|
||||
public DescriptorService getDescriptorService()
|
||||
{
|
||||
return (DescriptorService)getService(DESCRIPTOR_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getNodeService()
|
||||
*/
|
||||
public NodeService getNodeService()
|
||||
{
|
||||
return (NodeService)getService(NODE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getNodeService()
|
||||
*/
|
||||
public AuthenticationService getAuthenticationService()
|
||||
{
|
||||
return (AuthenticationService)getService(AUTHENTICATION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getContentService()
|
||||
*/
|
||||
public ContentService getContentService()
|
||||
{
|
||||
return (ContentService)getService(CONTENT_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getMimetypeService()
|
||||
*/
|
||||
public MimetypeService getMimetypeService()
|
||||
{
|
||||
return (MimetypeService)getService(MIMETYPE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getVersionService()
|
||||
*/
|
||||
public VersionService getVersionService()
|
||||
{
|
||||
return (VersionService)getService(VERSION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getLockService()
|
||||
*/
|
||||
public LockService getLockService()
|
||||
{
|
||||
return (LockService)getService(LOCK_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getDictionaryService()
|
||||
*/
|
||||
public DictionaryService getDictionaryService()
|
||||
{
|
||||
return (DictionaryService)getService(DICTIONARY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getSearchService()
|
||||
*/
|
||||
public SearchService getSearchService()
|
||||
{
|
||||
return (SearchService)getService(SEARCH_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getTransactionService()
|
||||
*/
|
||||
public TransactionService getTransactionService()
|
||||
{
|
||||
return (TransactionService)getService(TRANSACTION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getRetryingTransactionHelper()
|
||||
*/
|
||||
public RetryingTransactionHelper getRetryingTransactionHelper()
|
||||
{
|
||||
return (RetryingTransactionHelper)getService(RETRYING_TRANSACTION_HELPER);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getCopyService()
|
||||
*/
|
||||
public CopyService getCopyService()
|
||||
{
|
||||
return (CopyService)getService(COPY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getCheckOutCheckInService()
|
||||
*/
|
||||
public CheckOutCheckInService getCheckOutCheckInService()
|
||||
{
|
||||
return (CheckOutCheckInService)getService(COCI_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getCategoryService()
|
||||
*/
|
||||
public CategoryService getCategoryService()
|
||||
{
|
||||
return (CategoryService)getService(CATEGORY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getNamespaceService()
|
||||
*/
|
||||
public NamespaceService getNamespaceService()
|
||||
{
|
||||
return (NamespaceService)getService(NAMESPACE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getImporterService()
|
||||
*/
|
||||
public ImporterService getImporterService()
|
||||
{
|
||||
return (ImporterService)getService(IMPORTER_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getExporterService()
|
||||
*/
|
||||
public ExporterService getExporterService()
|
||||
{
|
||||
return (ExporterService)getService(EXPORTER_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getRuleService()
|
||||
*/
|
||||
public RuleService getRuleService()
|
||||
{
|
||||
return (RuleService)getService(RULE_SERVICE);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getActionService()
|
||||
*/
|
||||
public ActionService getActionService()
|
||||
{
|
||||
return (ActionService)getService(ACTION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getPermissionService()
|
||||
*/
|
||||
public PermissionService getPermissionService()
|
||||
{
|
||||
return (PermissionService)getService(PERMISSIONS_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getAuthorityService()
|
||||
*/
|
||||
public AuthorityService getAuthorityService()
|
||||
{
|
||||
return (AuthorityService)getService(AUTHORITY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getTemplateService()
|
||||
*/
|
||||
public TemplateService getTemplateService()
|
||||
{
|
||||
return (TemplateService)getService(TEMPLATE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getTemplateService()
|
||||
*/
|
||||
public FileFolderService getFileFolderService()
|
||||
{
|
||||
return (FileFolderService)getService(FILE_FOLDER_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getScriptService()
|
||||
*/
|
||||
public ScriptService getScriptService()
|
||||
{
|
||||
return (ScriptService)getService(SCRIPT_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getWorkflowService()
|
||||
*/
|
||||
public WorkflowService getWorkflowService()
|
||||
{
|
||||
return (WorkflowService)getService(WORKFLOW_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getWorkflowService()
|
||||
*/
|
||||
public AuditService getAuditService()
|
||||
{
|
||||
return (AuditService)getService(AUDIT_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AVMService.
|
||||
* @return The AVMService or null if there is none.
|
||||
*/
|
||||
public AVMService getAVMService()
|
||||
{
|
||||
return (AVMService)getService(AVM_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AVMService.
|
||||
* @return The AVMService or null if there is none.
|
||||
*/
|
||||
public AVMService getAVMLockingAwareService()
|
||||
{
|
||||
return (AVMService)getService(AVM_LOCKING_AWARE_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AVM Sync Service.
|
||||
* @return The AVM Sync Service.
|
||||
*/
|
||||
public AVMSyncService getAVMSyncService()
|
||||
{
|
||||
return (AVMSyncService)getService(AVM_SYNC_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getOwnableService()
|
||||
*/
|
||||
public OwnableService getOwnableService()
|
||||
{
|
||||
return (OwnableService)getService(OWNABLE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getPersonService()
|
||||
*/
|
||||
public PersonService getPersonService()
|
||||
{
|
||||
return (PersonService)getService(PERSON_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getSiteService()
|
||||
*/
|
||||
public SiteService getSiteService()
|
||||
{
|
||||
return (SiteService) getService(SITE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getCrossRepositoryCopyService()
|
||||
*/
|
||||
public CrossRepositoryCopyService getCrossRepositoryCopyService()
|
||||
{
|
||||
return (CrossRepositoryCopyService)getService(CROSS_REPO_COPY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getAttributeService()
|
||||
*/
|
||||
public AttributeService getAttributeService()
|
||||
{
|
||||
return (AttributeService)getService(ATTRIBUTE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getContentFilterLanguagesService()
|
||||
*/
|
||||
public ContentFilterLanguagesService getContentFilterLanguagesService()
|
||||
{
|
||||
return (ContentFilterLanguagesService) getService(CONTENT_FILTER_LANGUAGES_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getAVMLockingService()
|
||||
*/
|
||||
public AVMLockingService getAVMLockingService()
|
||||
{
|
||||
return (AVMLockingService)getService(AVM_LOCKING_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getVirtServerRegistry()
|
||||
*/
|
||||
public VirtServerRegistry getVirtServerRegistry()
|
||||
{
|
||||
return (VirtServerRegistry)getService(VIRT_SERVER_REGISTRY);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getEditionService()
|
||||
*/
|
||||
public EditionService getEditionService()
|
||||
{
|
||||
return (EditionService) getService(EDITION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getMultilingualContentService()
|
||||
*/
|
||||
public MultilingualContentService getMultilingualContentService()
|
||||
{
|
||||
return (MultilingualContentService) getService(MULTILINGUAL_CONTENT_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.ServiceRegistry#getThumbnailService()
|
||||
*/
|
||||
public ThumbnailService getThumbnailService()
|
||||
{
|
||||
return (ThumbnailService)getService(THUMBNAIL_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.ServiceRegistry#getTaggingService()
|
||||
*/
|
||||
public TaggingService getTaggingService()
|
||||
{
|
||||
return (TaggingService)getService(TAGGING_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getDeploymentService()
|
||||
*/
|
||||
public DeploymentService getDeploymentService() {
|
||||
return (DeploymentService) getService(DEPLOYMENT_SERVICE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.alfresco.mbeans.VirtServerRegistry;
|
||||
import org.alfresco.repo.site.SiteService;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||
import org.alfresco.service.cmr.audit.AuditService;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentService;
|
||||
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
|
||||
import org.alfresco.service.cmr.ml.EditionService;
|
||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.CopyService;
|
||||
import org.alfresco.service.cmr.repository.CrossRepositoryCopyService;
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.ScriptService;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.cmr.search.CategoryService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.OwnableService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
||||
import org.alfresco.service.cmr.version.VersionService;
|
||||
import org.alfresco.service.cmr.view.ExporterService;
|
||||
import org.alfresco.service.cmr.view.ImporterService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.wcm.webproject.WebProjectService;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of a Service Registry based on the definition of
|
||||
* Services contained within a Spring Bean Factory.
|
||||
*
|
||||
* @author David Caruana
|
||||
*/
|
||||
public class ServiceDescriptorRegistry
|
||||
implements BeanFactoryAware, ServiceRegistry
|
||||
{
|
||||
// Bean Factory within which the registry lives
|
||||
private BeanFactory beanFactory = null;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
|
||||
*/
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
|
||||
{
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getServices()
|
||||
*/
|
||||
public Collection<QName> getServices()
|
||||
{
|
||||
// TODO: Implement
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#isServiceProvided(org.alfresco.repo.ref.QName)
|
||||
*/
|
||||
public boolean isServiceProvided(QName service)
|
||||
{
|
||||
// TODO: Implement
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getService(org.alfresco.repo.ref.QName)
|
||||
*/
|
||||
public Object getService(QName service)
|
||||
{
|
||||
return beanFactory.getBean(service.getLocalName());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getDescriptorService()
|
||||
*/
|
||||
public DescriptorService getDescriptorService()
|
||||
{
|
||||
return (DescriptorService)getService(DESCRIPTOR_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getNodeService()
|
||||
*/
|
||||
public NodeService getNodeService()
|
||||
{
|
||||
return (NodeService)getService(NODE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getNodeService()
|
||||
*/
|
||||
public AuthenticationService getAuthenticationService()
|
||||
{
|
||||
return (AuthenticationService)getService(AUTHENTICATION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getContentService()
|
||||
*/
|
||||
public ContentService getContentService()
|
||||
{
|
||||
return (ContentService)getService(CONTENT_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getMimetypeService()
|
||||
*/
|
||||
public MimetypeService getMimetypeService()
|
||||
{
|
||||
return (MimetypeService)getService(MIMETYPE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getVersionService()
|
||||
*/
|
||||
public VersionService getVersionService()
|
||||
{
|
||||
return (VersionService)getService(VERSION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getLockService()
|
||||
*/
|
||||
public LockService getLockService()
|
||||
{
|
||||
return (LockService)getService(LOCK_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.service.ServiceRegistry#getDictionaryService()
|
||||
*/
|
||||
public DictionaryService getDictionaryService()
|
||||
{
|
||||
return (DictionaryService)getService(DICTIONARY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getSearchService()
|
||||
*/
|
||||
public SearchService getSearchService()
|
||||
{
|
||||
return (SearchService)getService(SEARCH_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getTransactionService()
|
||||
*/
|
||||
public TransactionService getTransactionService()
|
||||
{
|
||||
return (TransactionService)getService(TRANSACTION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getRetryingTransactionHelper()
|
||||
*/
|
||||
public RetryingTransactionHelper getRetryingTransactionHelper()
|
||||
{
|
||||
return (RetryingTransactionHelper)getService(RETRYING_TRANSACTION_HELPER);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getCopyService()
|
||||
*/
|
||||
public CopyService getCopyService()
|
||||
{
|
||||
return (CopyService)getService(COPY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getCheckOutCheckInService()
|
||||
*/
|
||||
public CheckOutCheckInService getCheckOutCheckInService()
|
||||
{
|
||||
return (CheckOutCheckInService)getService(COCI_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getCategoryService()
|
||||
*/
|
||||
public CategoryService getCategoryService()
|
||||
{
|
||||
return (CategoryService)getService(CATEGORY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getNamespaceService()
|
||||
*/
|
||||
public NamespaceService getNamespaceService()
|
||||
{
|
||||
return (NamespaceService)getService(NAMESPACE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getImporterService()
|
||||
*/
|
||||
public ImporterService getImporterService()
|
||||
{
|
||||
return (ImporterService)getService(IMPORTER_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getExporterService()
|
||||
*/
|
||||
public ExporterService getExporterService()
|
||||
{
|
||||
return (ExporterService)getService(EXPORTER_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getRuleService()
|
||||
*/
|
||||
public RuleService getRuleService()
|
||||
{
|
||||
return (RuleService)getService(RULE_SERVICE);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getActionService()
|
||||
*/
|
||||
public ActionService getActionService()
|
||||
{
|
||||
return (ActionService)getService(ACTION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getPermissionService()
|
||||
*/
|
||||
public PermissionService getPermissionService()
|
||||
{
|
||||
return (PermissionService)getService(PERMISSIONS_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getAuthorityService()
|
||||
*/
|
||||
public AuthorityService getAuthorityService()
|
||||
{
|
||||
return (AuthorityService)getService(AUTHORITY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getTemplateService()
|
||||
*/
|
||||
public TemplateService getTemplateService()
|
||||
{
|
||||
return (TemplateService)getService(TEMPLATE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getTemplateService()
|
||||
*/
|
||||
public FileFolderService getFileFolderService()
|
||||
{
|
||||
return (FileFolderService)getService(FILE_FOLDER_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getScriptService()
|
||||
*/
|
||||
public ScriptService getScriptService()
|
||||
{
|
||||
return (ScriptService)getService(SCRIPT_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getWorkflowService()
|
||||
*/
|
||||
public WorkflowService getWorkflowService()
|
||||
{
|
||||
return (WorkflowService)getService(WORKFLOW_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getWorkflowService()
|
||||
*/
|
||||
public AuditService getAuditService()
|
||||
{
|
||||
return (AuditService)getService(AUDIT_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AVMService.
|
||||
* @return The AVMService or null if there is none.
|
||||
*/
|
||||
public AVMService getAVMService()
|
||||
{
|
||||
return (AVMService)getService(AVM_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AVMService.
|
||||
* @return The AVMService or null if there is none.
|
||||
*/
|
||||
public AVMService getAVMLockingAwareService()
|
||||
{
|
||||
return (AVMService)getService(AVM_LOCKING_AWARE_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AVM Sync Service.
|
||||
* @return The AVM Sync Service.
|
||||
*/
|
||||
public AVMSyncService getAVMSyncService()
|
||||
{
|
||||
return (AVMSyncService)getService(AVM_SYNC_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getOwnableService()
|
||||
*/
|
||||
public OwnableService getOwnableService()
|
||||
{
|
||||
return (OwnableService)getService(OWNABLE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getPersonService()
|
||||
*/
|
||||
public PersonService getPersonService()
|
||||
{
|
||||
return (PersonService)getService(PERSON_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getSiteService()
|
||||
*/
|
||||
public SiteService getSiteService()
|
||||
{
|
||||
return (SiteService) getService(SITE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getCrossRepositoryCopyService()
|
||||
*/
|
||||
public CrossRepositoryCopyService getCrossRepositoryCopyService()
|
||||
{
|
||||
return (CrossRepositoryCopyService)getService(CROSS_REPO_COPY_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getAttributeService()
|
||||
*/
|
||||
public AttributeService getAttributeService()
|
||||
{
|
||||
return (AttributeService)getService(ATTRIBUTE_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getContentFilterLanguagesService()
|
||||
*/
|
||||
public ContentFilterLanguagesService getContentFilterLanguagesService()
|
||||
{
|
||||
return (ContentFilterLanguagesService) getService(CONTENT_FILTER_LANGUAGES_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getAVMLockingService()
|
||||
*/
|
||||
public AVMLockingService getAVMLockingService()
|
||||
{
|
||||
return (AVMLockingService)getService(AVM_LOCKING_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getVirtServerRegistry()
|
||||
*/
|
||||
public VirtServerRegistry getVirtServerRegistry()
|
||||
{
|
||||
return (VirtServerRegistry)getService(VIRT_SERVER_REGISTRY);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getEditionService()
|
||||
*/
|
||||
public EditionService getEditionService()
|
||||
{
|
||||
return (EditionService) getService(EDITION_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getMultilingualContentService()
|
||||
*/
|
||||
public MultilingualContentService getMultilingualContentService()
|
||||
{
|
||||
return (MultilingualContentService) getService(MULTILINGUAL_CONTENT_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.ServiceRegistry#getThumbnailService()
|
||||
*/
|
||||
public ThumbnailService getThumbnailService()
|
||||
{
|
||||
return (ThumbnailService)getService(THUMBNAIL_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.ServiceRegistry#getTaggingService()
|
||||
*/
|
||||
public TaggingService getTaggingService()
|
||||
{
|
||||
return (TaggingService)getService(TAGGING_SERVICE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getDeploymentService()
|
||||
*/
|
||||
public DeploymentService getDeploymentService() {
|
||||
return (DeploymentService) getService(DEPLOYMENT_SERVICE);
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.ServiceRegistry#getWebProjectService()
|
||||
*/
|
||||
public WebProjectService getWebProjectService() {
|
||||
return (WebProjectService) getService(WEBPROJECT_SERVICE);
|
||||
}
|
||||
}
|
||||
|
@@ -1,55 +1,39 @@
|
||||
/*
|
||||
* 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"
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Copyright 2007 Alfresco Inc.
|
||||
*
|
||||
* 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 received a copy of the text describing the FLOSS exception,
|
||||
* and it is also available here: http://www.alfresco.com/legal/licensing
|
||||
*
|
||||
*
|
||||
* Author Jon Cox <jcox@alfresco.com>
|
||||
* File SandboxConstants.java
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
package org.alfresco.sandbox;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* AVM sandbox constants
|
||||
*/
|
||||
public class SandboxConstants
|
||||
* WCM sandbox constants
|
||||
*
|
||||
* @deprecated refer to org.alfresco.wcm.sandbox.SandboxConstants
|
||||
*/
|
||||
public class SandboxConstants extends org.alfresco.wcm.sandbox.SandboxConstants
|
||||
{
|
||||
// system property keys for sandbox identification and DNS virtualisation mapping
|
||||
public final static String PROP_BACKGROUND_LAYER = ".background-layer.";
|
||||
public final static String PROP_SANDBOXID = ".sandbox-id.";
|
||||
public final static String PROP_DNS = ".dns.";
|
||||
public final static String PROP_SANDBOX_STORE_PREFIX = ".sandbox.store.";
|
||||
|
||||
public final static QName PROP_SANDBOX_STAGING_MAIN = QName.createQName(null, ".sandbox.staging.main");
|
||||
public final static QName PROP_SANDBOX_STAGING_PREVIEW = QName.createQName(null, ".sandbox.staging.preview");
|
||||
public final static QName PROP_SANDBOX_AUTHOR_MAIN = QName.createQName(null, ".sandbox.author.main");
|
||||
public final static QName PROP_SANDBOX_AUTHOR_PREVIEW = QName.createQName(null, ".sandbox.author.preview");
|
||||
public final static QName PROP_SANDBOX_WORKFLOW_MAIN = QName.createQName(null, ".sandbox.workflow.main");
|
||||
public final static QName PROP_SANDBOX_WORKFLOW_PREVIEW = QName.createQName(null, ".sandbox.workflow.preview");
|
||||
public final static QName PROP_SANDBOX_AUTHOR_WORKFLOW_MAIN = QName.createQName(null, ".sandbox.author.workflow.main");
|
||||
public final static QName PROP_SANDBOX_AUTHOR_WORKFLOW_PREVIEW = QName.createQName(null, ".sandbox.author.workflow.preview");
|
||||
public final static QName PROP_WEBSITE_NAME = QName.createQName(null, ".website.name");
|
||||
public final static QName PROP_AUTHOR_NAME = QName.createQName(null, ".author.name");
|
||||
public final static QName PROP_WEB_PROJECT_NODE_REF = QName.createQName(null, ".web_project.noderef");
|
||||
public final static QName PROP_LINK_VALIDATION_REPORT = QName.createQName(null, ".link.validation.report");
|
||||
public final static QName PROP_LAST_DEPLOYMENT_ID = QName.createQName(null, ".deployment.id");
|
||||
}
|
||||
|
@@ -1,423 +1,432 @@
|
||||
/*
|
||||
* 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.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.alfresco.mbeans.VirtServerRegistry;
|
||||
import org.alfresco.repo.site.SiteService;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||
import org.alfresco.service.cmr.audit.AuditService;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
|
||||
import org.alfresco.service.cmr.ml.EditionService;
|
||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.CopyService;
|
||||
import org.alfresco.service.cmr.repository.CrossRepositoryCopyService;
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.ScriptService;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.cmr.search.CategoryService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.OwnableService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
||||
import org.alfresco.service.cmr.version.VersionService;
|
||||
import org.alfresco.service.cmr.view.ExporterService;
|
||||
import org.alfresco.service.cmr.view.ImporterService;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
|
||||
|
||||
/**
|
||||
* This interface represents the registry of public Repository Services.
|
||||
* The registry provides meta-data about each service and provides
|
||||
* access to the service interface.
|
||||
*
|
||||
* @author David Caruana
|
||||
*/
|
||||
@PublicService
|
||||
public interface ServiceRegistry
|
||||
{
|
||||
// Service Bean Names
|
||||
|
||||
static final String SERVICE_REGISTRY = "ServiceRegistry";
|
||||
|
||||
static final QName REGISTRY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ServiceRegistry");
|
||||
static final QName DESCRIPTOR_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DescriptorService");
|
||||
static final QName TRANSACTION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "TransactionService");
|
||||
static final QName RETRYING_TRANSACTION_HELPER = QName.createQName(NamespaceService.ALFRESCO_URI, "retryingTransactionHelper");
|
||||
static final QName AUTHENTICATION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AuthenticationService");
|
||||
static final QName NAMESPACE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "NamespaceService");
|
||||
static final QName DICTIONARY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DictionaryService");
|
||||
static final QName NODE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "NodeService");
|
||||
static final QName CONTENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ContentService");
|
||||
static final QName MIMETYPE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "MimetypeService");
|
||||
static final QName CONTENT_FILTER_LANGUAGES_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ContentFilterLanguagesService");
|
||||
static final QName MULTILINGUAL_CONTENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "MultilingualContentService");
|
||||
static final QName EDITION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "EditionService");
|
||||
static final QName SEARCH_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "SearchService");
|
||||
static final QName CATEGORY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CategoryService");
|
||||
static final QName COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CopyService");
|
||||
static final QName LOCK_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "LockService");
|
||||
static final QName VERSION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "VersionService");
|
||||
static final QName COCI_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CheckoutCheckinService");
|
||||
static final QName RULE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RuleService");
|
||||
static final QName IMPORTER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ImporterService");
|
||||
static final QName EXPORTER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ExporterService");
|
||||
static final QName ACTION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ActionService");
|
||||
static final QName PERMISSIONS_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "PermissionService");
|
||||
static final QName AUTHORITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AuthorityService");
|
||||
static final QName TEMPLATE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "TemplateService");
|
||||
static final QName FILE_FOLDER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FileFolderService");
|
||||
static final QName SCRIPT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ScriptService");
|
||||
static final QName WORKFLOW_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "WorkflowService");
|
||||
static final QName AUDIT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AuditService");
|
||||
static final QName OWNABLE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "OwnableService");
|
||||
static final QName PERSON_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "PersonService");
|
||||
static final QName SITE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "SiteService");
|
||||
static final QName AVM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMService");
|
||||
static final QName AVM_LOCKING_AWARE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMLockingAwareService");
|
||||
static final QName AVM_SYNC_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMSyncService");
|
||||
static final QName CROSS_REPO_COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CrossRepositoryCopyService");
|
||||
static final QName ATTRIBUTE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AttributeService");
|
||||
static final QName AVM_LOCKING_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMLockingService");
|
||||
static final QName VIRT_SERVER_REGISTRY = QName.createQName(NamespaceService.ALFRESCO_URI, "VirtServerRegistry");
|
||||
static final QName THUMBNAIL_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ThumbnailService");
|
||||
static final QName TAGGING_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "TaggingService");
|
||||
static final QName DEPLOYMENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DeploymentService");
|
||||
|
||||
/**
|
||||
* Get the list of services provided by the Repository
|
||||
*
|
||||
* @return list of provided Services
|
||||
*/
|
||||
@NotAuditable
|
||||
Collection<QName> getServices();
|
||||
|
||||
/**
|
||||
* Is the specified service provided by the Repository?
|
||||
*
|
||||
* @param service name of service to test provision of
|
||||
* @return true => provided, false => not provided
|
||||
*/
|
||||
@NotAuditable
|
||||
boolean isServiceProvided(QName service);
|
||||
|
||||
/**
|
||||
* Get the specified service.
|
||||
*
|
||||
* @param service name of service to retrieve
|
||||
* @return the service interface (must cast to interface as described in service meta-data)
|
||||
*/
|
||||
@NotAuditable
|
||||
Object getService(QName service);
|
||||
|
||||
/**
|
||||
* @return the descriptor service
|
||||
*/
|
||||
@NotAuditable
|
||||
DescriptorService getDescriptorService();
|
||||
|
||||
/**
|
||||
* @return the transaction service
|
||||
*/
|
||||
@NotAuditable
|
||||
TransactionService getTransactionService();
|
||||
|
||||
/**
|
||||
* @return the transaction service
|
||||
*/
|
||||
@NotAuditable
|
||||
RetryingTransactionHelper getRetryingTransactionHelper();
|
||||
|
||||
/**
|
||||
* @return the namespace service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
NamespaceService getNamespaceService();
|
||||
|
||||
/**
|
||||
* @return the authentication service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
AuthenticationService getAuthenticationService();
|
||||
|
||||
/**
|
||||
* @return the node service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
NodeService getNodeService();
|
||||
|
||||
/**
|
||||
* @return the content service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
ContentService getContentService();
|
||||
|
||||
/**
|
||||
* @return the mimetype service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
MimetypeService getMimetypeService();
|
||||
|
||||
/**
|
||||
* @return the content filter languages service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
ContentFilterLanguagesService getContentFilterLanguagesService();
|
||||
|
||||
/**
|
||||
* @return the search service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
SearchService getSearchService();
|
||||
|
||||
/**
|
||||
* @return the version service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
VersionService getVersionService();
|
||||
|
||||
/**
|
||||
* @return the lock service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
LockService getLockService();
|
||||
|
||||
/**
|
||||
* @return the dictionary service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
DictionaryService getDictionaryService();
|
||||
|
||||
/**
|
||||
* @return the copy service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
CopyService getCopyService();
|
||||
|
||||
/**
|
||||
* @return the checkout / checkin service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
CheckOutCheckInService getCheckOutCheckInService();
|
||||
|
||||
/**
|
||||
* @return the category service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
CategoryService getCategoryService();
|
||||
|
||||
/**
|
||||
* @return the importer service or null if not present
|
||||
*/
|
||||
@NotAuditable
|
||||
ImporterService getImporterService();
|
||||
|
||||
/**
|
||||
* @return the exporter service or null if not present
|
||||
*/
|
||||
@NotAuditable
|
||||
ExporterService getExporterService();
|
||||
|
||||
/**
|
||||
* @return the rule service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
RuleService getRuleService();
|
||||
|
||||
/**
|
||||
* @return the action service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
ActionService getActionService();
|
||||
|
||||
/**
|
||||
* @return the permission service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
PermissionService getPermissionService();
|
||||
|
||||
/**
|
||||
* @return the authority service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
AuthorityService getAuthorityService();
|
||||
|
||||
/**
|
||||
* @return the template service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
TemplateService getTemplateService();
|
||||
|
||||
/**
|
||||
* @return the file-folder manipulation service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
FileFolderService getFileFolderService();
|
||||
|
||||
/**
|
||||
* @return the script execution service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
ScriptService getScriptService();
|
||||
|
||||
/**
|
||||
* @return the workflow service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
WorkflowService getWorkflowService();
|
||||
|
||||
/**
|
||||
* @return the audit service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
AuditService getAuditService();
|
||||
|
||||
/**
|
||||
* Get the AVMService.
|
||||
* @return The AVM service (or null if one is not provided);
|
||||
*/
|
||||
@NotAuditable
|
||||
AVMService getAVMService();
|
||||
|
||||
/**
|
||||
* Get the AVMLockingAwareService.
|
||||
* @return The AVM locking aware service (or null if one is not provided);
|
||||
*/
|
||||
@NotAuditable
|
||||
AVMService getAVMLockingAwareService();
|
||||
|
||||
/**
|
||||
* Get the AVM Sync Service.
|
||||
* @return The AVM Sync Service.
|
||||
*/
|
||||
@NotAuditable
|
||||
AVMSyncService getAVMSyncService();
|
||||
|
||||
/**
|
||||
* Get the ownable service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
OwnableService getOwnableService();
|
||||
|
||||
/**
|
||||
* Get the person service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
PersonService getPersonService();
|
||||
|
||||
/**
|
||||
* Get the site service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
SiteService getSiteService();
|
||||
|
||||
/**
|
||||
* Get the cross repository copy service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
CrossRepositoryCopyService getCrossRepositoryCopyService();
|
||||
|
||||
/**
|
||||
* Get the attribute service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
AttributeService getAttributeService();
|
||||
|
||||
/**
|
||||
* Get the AVM locking service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
AVMLockingService getAVMLockingService();
|
||||
|
||||
/**
|
||||
* Get the Virtualisation Server registry service bean
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
VirtServerRegistry getVirtServerRegistry();
|
||||
|
||||
/**
|
||||
* Get the Multilingual Content Service
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
MultilingualContentService getMultilingualContentService();
|
||||
|
||||
/**
|
||||
* Get the Edition Service
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
EditionService getEditionService();
|
||||
|
||||
/**
|
||||
* Get the Thumbnail Service
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
ThumbnailService getThumbnailService();
|
||||
|
||||
/**
|
||||
* Get the Tagging Service
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
TaggingService getTaggingService();
|
||||
|
||||
/**
|
||||
* Get the Deployment Service
|
||||
* @return the deployment service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
DeploymentService getDeploymentService();
|
||||
}
|
||||
/*
|
||||
* 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.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.alfresco.mbeans.VirtServerRegistry;
|
||||
import org.alfresco.repo.site.SiteService;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||
import org.alfresco.service.cmr.audit.AuditService;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
|
||||
import org.alfresco.service.cmr.ml.EditionService;
|
||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.CopyService;
|
||||
import org.alfresco.service.cmr.repository.CrossRepositoryCopyService;
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.ScriptService;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.cmr.search.CategoryService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.OwnableService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
||||
import org.alfresco.service.cmr.version.VersionService;
|
||||
import org.alfresco.service.cmr.view.ExporterService;
|
||||
import org.alfresco.service.cmr.view.ImporterService;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.descriptor.DescriptorService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.wcm.webproject.WebProjectService;
|
||||
|
||||
|
||||
/**
|
||||
* This interface represents the registry of public Repository Services.
|
||||
* The registry provides meta-data about each service and provides
|
||||
* access to the service interface.
|
||||
*
|
||||
* @author David Caruana
|
||||
*/
|
||||
@PublicService
|
||||
public interface ServiceRegistry
|
||||
{
|
||||
// Service Bean Names
|
||||
|
||||
static final String SERVICE_REGISTRY = "ServiceRegistry";
|
||||
|
||||
static final QName REGISTRY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ServiceRegistry");
|
||||
static final QName DESCRIPTOR_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DescriptorService");
|
||||
static final QName TRANSACTION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "TransactionService");
|
||||
static final QName RETRYING_TRANSACTION_HELPER = QName.createQName(NamespaceService.ALFRESCO_URI, "retryingTransactionHelper");
|
||||
static final QName AUTHENTICATION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AuthenticationService");
|
||||
static final QName NAMESPACE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "NamespaceService");
|
||||
static final QName DICTIONARY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DictionaryService");
|
||||
static final QName NODE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "NodeService");
|
||||
static final QName CONTENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ContentService");
|
||||
static final QName MIMETYPE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "MimetypeService");
|
||||
static final QName CONTENT_FILTER_LANGUAGES_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ContentFilterLanguagesService");
|
||||
static final QName MULTILINGUAL_CONTENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "MultilingualContentService");
|
||||
static final QName EDITION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "EditionService");
|
||||
static final QName SEARCH_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "SearchService");
|
||||
static final QName CATEGORY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CategoryService");
|
||||
static final QName COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CopyService");
|
||||
static final QName LOCK_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "LockService");
|
||||
static final QName VERSION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "VersionService");
|
||||
static final QName COCI_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CheckoutCheckinService");
|
||||
static final QName RULE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RuleService");
|
||||
static final QName IMPORTER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ImporterService");
|
||||
static final QName EXPORTER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ExporterService");
|
||||
static final QName ACTION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ActionService");
|
||||
static final QName PERMISSIONS_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "PermissionService");
|
||||
static final QName AUTHORITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AuthorityService");
|
||||
static final QName TEMPLATE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "TemplateService");
|
||||
static final QName FILE_FOLDER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FileFolderService");
|
||||
static final QName SCRIPT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ScriptService");
|
||||
static final QName WORKFLOW_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "WorkflowService");
|
||||
static final QName AUDIT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AuditService");
|
||||
static final QName OWNABLE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "OwnableService");
|
||||
static final QName PERSON_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "PersonService");
|
||||
static final QName SITE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "SiteService");
|
||||
static final QName AVM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMService");
|
||||
static final QName AVM_LOCKING_AWARE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMLockingAwareService");
|
||||
static final QName AVM_SYNC_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMSyncService");
|
||||
static final QName CROSS_REPO_COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CrossRepositoryCopyService");
|
||||
static final QName ATTRIBUTE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AttributeService");
|
||||
static final QName AVM_LOCKING_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMLockingService");
|
||||
static final QName VIRT_SERVER_REGISTRY = QName.createQName(NamespaceService.ALFRESCO_URI, "VirtServerRegistry");
|
||||
static final QName THUMBNAIL_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ThumbnailService");
|
||||
static final QName TAGGING_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "TaggingService");
|
||||
static final QName DEPLOYMENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DeploymentService");
|
||||
static final QName WEBPROJECT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "WebProjectService");
|
||||
|
||||
/**
|
||||
* Get the list of services provided by the Repository
|
||||
*
|
||||
* @return list of provided Services
|
||||
*/
|
||||
@NotAuditable
|
||||
Collection<QName> getServices();
|
||||
|
||||
/**
|
||||
* Is the specified service provided by the Repository?
|
||||
*
|
||||
* @param service name of service to test provision of
|
||||
* @return true => provided, false => not provided
|
||||
*/
|
||||
@NotAuditable
|
||||
boolean isServiceProvided(QName service);
|
||||
|
||||
/**
|
||||
* Get the specified service.
|
||||
*
|
||||
* @param service name of service to retrieve
|
||||
* @return the service interface (must cast to interface as described in service meta-data)
|
||||
*/
|
||||
@NotAuditable
|
||||
Object getService(QName service);
|
||||
|
||||
/**
|
||||
* @return the descriptor service
|
||||
*/
|
||||
@NotAuditable
|
||||
DescriptorService getDescriptorService();
|
||||
|
||||
/**
|
||||
* @return the transaction service
|
||||
*/
|
||||
@NotAuditable
|
||||
TransactionService getTransactionService();
|
||||
|
||||
/**
|
||||
* @return the transaction service
|
||||
*/
|
||||
@NotAuditable
|
||||
RetryingTransactionHelper getRetryingTransactionHelper();
|
||||
|
||||
/**
|
||||
* @return the namespace service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
NamespaceService getNamespaceService();
|
||||
|
||||
/**
|
||||
* @return the authentication service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
AuthenticationService getAuthenticationService();
|
||||
|
||||
/**
|
||||
* @return the node service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
NodeService getNodeService();
|
||||
|
||||
/**
|
||||
* @return the content service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
ContentService getContentService();
|
||||
|
||||
/**
|
||||
* @return the mimetype service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
MimetypeService getMimetypeService();
|
||||
|
||||
/**
|
||||
* @return the content filter languages service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
ContentFilterLanguagesService getContentFilterLanguagesService();
|
||||
|
||||
/**
|
||||
* @return the search service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
SearchService getSearchService();
|
||||
|
||||
/**
|
||||
* @return the version service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
VersionService getVersionService();
|
||||
|
||||
/**
|
||||
* @return the lock service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
LockService getLockService();
|
||||
|
||||
/**
|
||||
* @return the dictionary service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
DictionaryService getDictionaryService();
|
||||
|
||||
/**
|
||||
* @return the copy service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
CopyService getCopyService();
|
||||
|
||||
/**
|
||||
* @return the checkout / checkin service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
CheckOutCheckInService getCheckOutCheckInService();
|
||||
|
||||
/**
|
||||
* @return the category service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
CategoryService getCategoryService();
|
||||
|
||||
/**
|
||||
* @return the importer service or null if not present
|
||||
*/
|
||||
@NotAuditable
|
||||
ImporterService getImporterService();
|
||||
|
||||
/**
|
||||
* @return the exporter service or null if not present
|
||||
*/
|
||||
@NotAuditable
|
||||
ExporterService getExporterService();
|
||||
|
||||
/**
|
||||
* @return the rule service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
RuleService getRuleService();
|
||||
|
||||
/**
|
||||
* @return the action service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
ActionService getActionService();
|
||||
|
||||
/**
|
||||
* @return the permission service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
PermissionService getPermissionService();
|
||||
|
||||
/**
|
||||
* @return the authority service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
AuthorityService getAuthorityService();
|
||||
|
||||
/**
|
||||
* @return the template service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
TemplateService getTemplateService();
|
||||
|
||||
/**
|
||||
* @return the file-folder manipulation service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
FileFolderService getFileFolderService();
|
||||
|
||||
/**
|
||||
* @return the script execution service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
ScriptService getScriptService();
|
||||
|
||||
/**
|
||||
* @return the workflow service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
WorkflowService getWorkflowService();
|
||||
|
||||
/**
|
||||
* @return the audit service (or null if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
AuditService getAuditService();
|
||||
|
||||
/**
|
||||
* Get the AVMService.
|
||||
* @return The AVM service (or null if one is not provided);
|
||||
*/
|
||||
@NotAuditable
|
||||
AVMService getAVMService();
|
||||
|
||||
/**
|
||||
* Get the AVMLockingAwareService.
|
||||
* @return The AVM locking aware service (or null if one is not provided);
|
||||
*/
|
||||
@NotAuditable
|
||||
AVMService getAVMLockingAwareService();
|
||||
|
||||
/**
|
||||
* Get the AVM Sync Service.
|
||||
* @return The AVM Sync Service.
|
||||
*/
|
||||
@NotAuditable
|
||||
AVMSyncService getAVMSyncService();
|
||||
|
||||
/**
|
||||
* Get the ownable service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
OwnableService getOwnableService();
|
||||
|
||||
/**
|
||||
* Get the person service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
PersonService getPersonService();
|
||||
|
||||
/**
|
||||
* Get the site service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
SiteService getSiteService();
|
||||
|
||||
/**
|
||||
* Get the cross repository copy service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
CrossRepositoryCopyService getCrossRepositoryCopyService();
|
||||
|
||||
/**
|
||||
* Get the attribute service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
AttributeService getAttributeService();
|
||||
|
||||
/**
|
||||
* Get the AVM locking service (or null if one is not provided)
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
AVMLockingService getAVMLockingService();
|
||||
|
||||
/**
|
||||
* Get the Virtualisation Server registry service bean
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
VirtServerRegistry getVirtServerRegistry();
|
||||
|
||||
/**
|
||||
* Get the Multilingual Content Service
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
MultilingualContentService getMultilingualContentService();
|
||||
|
||||
/**
|
||||
* Get the Edition Service
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
EditionService getEditionService();
|
||||
|
||||
/**
|
||||
* Get the Thumbnail Service
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
ThumbnailService getThumbnailService();
|
||||
|
||||
/**
|
||||
* Get the Tagging Service
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
TaggingService getTaggingService();
|
||||
|
||||
/**
|
||||
* Get the Deployment Service
|
||||
* @return the deployment service (or null, if one is not provided)
|
||||
*/
|
||||
@NotAuditable
|
||||
DeploymentService getDeploymentService();
|
||||
|
||||
/**
|
||||
* Get the WebProject Service
|
||||
* @return
|
||||
*/
|
||||
@NotAuditable
|
||||
WebProjectService getWebProjectService();
|
||||
}
|
||||
|
60
source/java/org/alfresco/wcm/sandbox/SandboxConstants.java
Normal file
60
source/java/org/alfresco/wcm/sandbox/SandboxConstants.java
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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"
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Author Jon Cox <jcox@alfresco.com>
|
||||
* File SandboxConstants.java
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
package org.alfresco.wcm.sandbox;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* WCM sandbox constants
|
||||
*/
|
||||
public class SandboxConstants
|
||||
{
|
||||
// system property keys for sandbox identification and DNS virtualisation mapping
|
||||
public final static String PROP_BACKGROUND_LAYER = ".background-layer.";
|
||||
public final static String PROP_SANDBOXID = ".sandbox-id.";
|
||||
public final static String PROP_DNS = ".dns.";
|
||||
public final static String PROP_SANDBOX_STORE_PREFIX = ".sandbox.store.";
|
||||
|
||||
public final static QName PROP_SANDBOX_STAGING_MAIN = QName.createQName(null, ".sandbox.staging.main");
|
||||
public final static QName PROP_SANDBOX_STAGING_PREVIEW = QName.createQName(null, ".sandbox.staging.preview");
|
||||
public final static QName PROP_SANDBOX_AUTHOR_MAIN = QName.createQName(null, ".sandbox.author.main");
|
||||
public final static QName PROP_SANDBOX_AUTHOR_PREVIEW = QName.createQName(null, ".sandbox.author.preview");
|
||||
public final static QName PROP_SANDBOX_WORKFLOW_MAIN = QName.createQName(null, ".sandbox.workflow.main");
|
||||
public final static QName PROP_SANDBOX_WORKFLOW_PREVIEW = QName.createQName(null, ".sandbox.workflow.preview");
|
||||
public final static QName PROP_SANDBOX_AUTHOR_WORKFLOW_MAIN = QName.createQName(null, ".sandbox.author.workflow.main");
|
||||
public final static QName PROP_SANDBOX_AUTHOR_WORKFLOW_PREVIEW = QName.createQName(null, ".sandbox.author.workflow.preview");
|
||||
public final static QName PROP_WEBSITE_NAME = QName.createQName(null, ".website.name");
|
||||
public final static QName PROP_AUTHOR_NAME = QName.createQName(null, ".author.name");
|
||||
public final static QName PROP_WEB_PROJECT_NODE_REF = QName.createQName(null, ".web_project.noderef");
|
||||
|
||||
public final static QName PROP_LINK_VALIDATION_REPORT = QName.createQName(null, ".link.validation.report");
|
||||
public final static QName PROP_LAST_DEPLOYMENT_ID = QName.createQName(null, ".deployment.id");
|
||||
}
|
634
source/java/org/alfresco/wcm/sandbox/SandboxFactory.java
Normal file
634
source/java/org/alfresco/wcm/sandbox/SandboxFactory.java
Normal file
@@ -0,0 +1,634 @@
|
||||
/*
|
||||
* 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.wcm.sandbox;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.config.JNDIConstants;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.DNSNameMangler;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.wcm.util.WCMUtil;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Helper factory to create WCM sandbox structures
|
||||
*
|
||||
* @author Kevin Roast
|
||||
* @author janv
|
||||
*/
|
||||
public final class SandboxFactory extends WCMUtil
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(SandboxFactory.class);
|
||||
|
||||
/** Services */
|
||||
private PermissionService permissionService;
|
||||
private AVMService avmService;
|
||||
private NodeService nodeService;
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
public void setPermissionService(PermissionService permissionService)
|
||||
{
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
public void setAvmService(AVMService avmService)
|
||||
{
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor
|
||||
*/
|
||||
private SandboxFactory()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the staging sandbox for the named store.
|
||||
*
|
||||
* A staging sandbox is comprised of two stores, the first named 'storename-staging' with a
|
||||
* preview store named 'storename-preview' layered over the staging store.
|
||||
*
|
||||
* Various store meta-data properties are set including:
|
||||
* Identifier for store-types: .sandbox.staging.main and .sandbox.staging.preview
|
||||
* Store-id: .sandbox-id.<guid> (unique across all stores in the sandbox)
|
||||
* DNS: .dns.<store> = <path-to-webapps-root>
|
||||
* Website Name: .website.name = website name
|
||||
*
|
||||
* @param storeId The store name to create the sandbox for.
|
||||
* @param webProjectNodeRef The noderef for the webproject.
|
||||
* @param branchStoreId The ID of the store to branch this staging store from.
|
||||
*/
|
||||
public SandboxInfo createStagingSandbox(String storeId,
|
||||
NodeRef webProjectNodeRef,
|
||||
String branchStoreId)
|
||||
{
|
||||
// create the 'staging' store for the website
|
||||
String stagingStoreName = WCMUtil.buildStagingStoreName(storeId);
|
||||
avmService.createStore(stagingStoreName);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Created staging sandbox store: " + stagingStoreName);
|
||||
}
|
||||
|
||||
// we can either branch from an existing staging store or create a new structure
|
||||
if (branchStoreId != null)
|
||||
{
|
||||
String branchStorePath = WCMUtil.buildStagingStoreName(branchStoreId) + ":/" +
|
||||
JNDIConstants.DIR_DEFAULT_WWW;
|
||||
avmService.createBranch(-1, branchStorePath,
|
||||
stagingStoreName + ":/", JNDIConstants.DIR_DEFAULT_WWW);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create the system directories 'www' and 'avm_webapps'
|
||||
avmService.createDirectory(stagingStoreName + ":/", JNDIConstants.DIR_DEFAULT_WWW);
|
||||
avmService.createDirectory(WCMUtil.buildStoreRootPath(stagingStoreName),
|
||||
JNDIConstants.DIR_DEFAULT_APPBASE);
|
||||
}
|
||||
|
||||
|
||||
// set staging area permissions
|
||||
setStagingPermissions(storeId, webProjectNodeRef);
|
||||
|
||||
// Add permissions for layers
|
||||
|
||||
// tag the store with the store type
|
||||
avmService.setStoreProperty(stagingStoreName,
|
||||
SandboxConstants.PROP_SANDBOX_STAGING_MAIN,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
avmService.setStoreProperty(stagingStoreName,
|
||||
SandboxConstants.PROP_WEB_PROJECT_NODE_REF,
|
||||
new PropertyValue(DataTypeDefinition.NODE_REF, webProjectNodeRef));
|
||||
|
||||
// tag the store with the DNS name property
|
||||
tagStoreDNSPath(avmService, stagingStoreName, storeId);
|
||||
|
||||
// snapshot the store
|
||||
avmService.createSnapshot(stagingStoreName, null, null);
|
||||
|
||||
|
||||
// create the 'preview' store for the website
|
||||
String previewStoreName = WCMUtil.buildStagingPreviewStoreName(storeId);
|
||||
avmService.createStore(previewStoreName);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Created staging preview sandbox store: " + previewStoreName +
|
||||
" above " + stagingStoreName);
|
||||
}
|
||||
|
||||
// create a layered directory pointing to 'www' in the staging area
|
||||
avmService.createLayeredDirectory(WCMUtil.buildStoreRootPath(stagingStoreName),
|
||||
previewStoreName + ":/",
|
||||
JNDIConstants.DIR_DEFAULT_WWW);
|
||||
|
||||
|
||||
// apply READ permissions for all users
|
||||
//dirRef = AVMNodeConverter.ToNodeRef(-1, WCMUtil.buildStoreRootPath(previewStoreName));
|
||||
//permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
|
||||
// tag the store with the store type
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
SandboxConstants.PROP_SANDBOX_STAGING_PREVIEW,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the DNS name property
|
||||
tagStoreDNSPath(avmService, previewStoreName, storeId, "preview");
|
||||
|
||||
// The preview store depends on the main staging store (dist=1)
|
||||
tagStoreBackgroundLayer(avmService,previewStoreName,stagingStoreName,1);
|
||||
|
||||
// snapshot the store
|
||||
avmService.createSnapshot(previewStoreName, null, null);
|
||||
|
||||
|
||||
// tag all related stores to indicate that they are part of a single sandbox
|
||||
final QName sandboxIdProp = QName.createQName(SandboxConstants.PROP_SANDBOXID + GUID.generate());
|
||||
|
||||
avmService.setStoreProperty(stagingStoreName,
|
||||
sandboxIdProp,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
sandboxIdProp,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
dumpStoreProperties(avmService, stagingStoreName);
|
||||
dumpStoreProperties(avmService, previewStoreName);
|
||||
}
|
||||
|
||||
return new SandboxInfo( new String[] { stagingStoreName, previewStoreName } );
|
||||
}
|
||||
|
||||
protected void setStagingPermissions(String storeId, NodeRef webProjectNodeRef)
|
||||
{
|
||||
String storeName = WCMUtil.buildStagingStoreName(storeId);
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, WCMUtil.buildStoreRootPath(storeName));
|
||||
|
||||
// Apply sepcific user permissions as set on the web project
|
||||
// All these will be masked out
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
|
||||
webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
{
|
||||
NodeRef userInfoRef = ref.getChildRef();
|
||||
String username = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
|
||||
permissionService.setPermission(dirRef, username, userrole, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setStagingPermissionMasks(String storeId)
|
||||
{
|
||||
String storeName = WCMUtil.buildStagingStoreName(storeId);
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, WCMUtil.buildStoreRootPath(storeName));
|
||||
|
||||
// Set store permission masks
|
||||
String currentUser = AuthenticationUtil.getCurrentUserName();
|
||||
permissionService.setPermission(dirRef.getStoreRef(), currentUser, PermissionService.CHANGE_PERMISSIONS, true);
|
||||
permissionService.setPermission(dirRef.getStoreRef(), currentUser, PermissionService.READ_PERMISSIONS, true);
|
||||
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
|
||||
// apply READ permissions for all users
|
||||
permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
}
|
||||
|
||||
public void updateStagingAreaManagers(String storeId, NodeRef webProjectNodeRef, final List<String> managers)
|
||||
{
|
||||
// The stores have the mask set in updateSandboxManagers
|
||||
String storeName = WCMUtil.buildStagingStoreName(storeId);
|
||||
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, WCMUtil.buildStoreRootPath(storeName));
|
||||
for (String manager : managers)
|
||||
{
|
||||
permissionService.setPermission(dirRef, manager, WCMUtil.ROLE_CONTENT_MANAGER, true);
|
||||
|
||||
// give the manager change permissions permission in the staging area store
|
||||
permissionService.setPermission(dirRef.getStoreRef(), manager,
|
||||
PermissionService.CHANGE_PERMISSIONS, true);
|
||||
permissionService.setPermission(dirRef.getStoreRef(), manager,
|
||||
PermissionService.READ_PERMISSIONS, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void addStagingAreaUser(String storeId, String authority, String role)
|
||||
{
|
||||
// The stores have the mask set in updateSandboxManagers
|
||||
String storeName = WCMUtil.buildStagingStoreName(storeId);
|
||||
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, WCMUtil.buildStoreRootPath(storeName));
|
||||
permissionService.setPermission(dirRef, authority, role, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a user sandbox for the named store.
|
||||
*
|
||||
* A user sandbox is comprised of two stores, the first
|
||||
* named 'storename--username' layered over the staging store with a preview store
|
||||
* named 'storename--username--preview' layered over the main store.
|
||||
*
|
||||
* Various store meta-data properties are set including:
|
||||
* Identifier for store-types: .sandbox.author.main and .sandbox.author.preview
|
||||
* Store-id: .sandbox-id.<guid> (unique across all stores in the sandbox)
|
||||
* DNS: .dns.<store> = <path-to-webapps-root>
|
||||
* Website Name: .website.name = website name
|
||||
*
|
||||
* @param storeId The store id to create the sandbox for
|
||||
* @param managers The list of authorities who have ContentManager role in the website
|
||||
* @param username Username of the user to create the sandbox for
|
||||
* @param role Role permission for the user
|
||||
* @return Summary information regarding the sandbox
|
||||
*/
|
||||
public SandboxInfo createUserSandbox(String storeId,
|
||||
List<String> managers,
|
||||
String username,
|
||||
String role)
|
||||
{
|
||||
// create the user 'main' store
|
||||
String userStoreName = WCMUtil.buildUserMainStoreName(storeId, username);
|
||||
String previewStoreName = WCMUtil.buildUserPreviewStoreName(storeId, username);
|
||||
|
||||
if (avmService.getStore(userStoreName) != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Not creating as store already exists: " + userStoreName);
|
||||
}
|
||||
return new SandboxInfo( new String[] { userStoreName, previewStoreName } );
|
||||
}
|
||||
|
||||
avmService.createStore(userStoreName);
|
||||
String stagingStoreName = WCMUtil.buildStagingStoreName(storeId);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Created user sandbox store: " + userStoreName +
|
||||
" above staging store " + stagingStoreName);
|
||||
|
||||
// create a layered directory pointing to 'www' in the staging area
|
||||
avmService.createLayeredDirectory(WCMUtil.buildStoreRootPath(stagingStoreName),
|
||||
userStoreName + ":/",
|
||||
JNDIConstants.DIR_DEFAULT_WWW);
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, WCMUtil.buildStoreRootPath(userStoreName));
|
||||
|
||||
// Apply access mask to the store (ACls are applie to the staging area)
|
||||
|
||||
// apply the user role permissions to the sandbox
|
||||
String currentUser = AuthenticationUtil.getCurrentUserName();
|
||||
permissionService.setPermission(dirRef.getStoreRef(), currentUser, WCMUtil.ROLE_CONTENT_MANAGER, true);
|
||||
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.ALL_PERMISSIONS, true);
|
||||
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
// apply the manager role permission for each manager in the web project
|
||||
for (String manager : managers)
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), manager, WCMUtil.ROLE_CONTENT_MANAGER, true);
|
||||
}
|
||||
|
||||
// tag the store with the store type
|
||||
avmService.setStoreProperty(userStoreName,
|
||||
SandboxConstants.PROP_SANDBOX_AUTHOR_MAIN,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the base name of the website so that corresponding
|
||||
// staging areas can be found.
|
||||
avmService.setStoreProperty(userStoreName,
|
||||
SandboxConstants.PROP_WEBSITE_NAME,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, storeId));
|
||||
|
||||
// tag the store, oddly enough, with its own store name for querying.
|
||||
avmService.setStoreProperty(userStoreName,
|
||||
QName.createQName(null, SandboxConstants.PROP_SANDBOX_STORE_PREFIX + userStoreName),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the DNS name property
|
||||
tagStoreDNSPath(avmService, userStoreName, storeId, username);
|
||||
|
||||
// The user store depends on the main staging store (dist=1)
|
||||
tagStoreBackgroundLayer(avmService,userStoreName,stagingStoreName,1);
|
||||
|
||||
// snapshot the store
|
||||
avmService.createSnapshot(userStoreName, null, null);
|
||||
|
||||
// create the user 'preview' store
|
||||
avmService.createStore(previewStoreName);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Created user preview sandbox store: " + previewStoreName +
|
||||
" above " + userStoreName);
|
||||
}
|
||||
|
||||
// create a layered directory pointing to 'www' in the user 'main' store
|
||||
avmService.createLayeredDirectory(WCMUtil.buildStoreRootPath(userStoreName),
|
||||
previewStoreName + ":/",
|
||||
JNDIConstants.DIR_DEFAULT_WWW);
|
||||
dirRef = AVMNodeConverter.ToNodeRef(-1, WCMUtil.buildStoreRootPath(previewStoreName));
|
||||
|
||||
// Apply access mask to the store (ACls are applied to the staging area)
|
||||
|
||||
// apply the user role permissions to the sandbox
|
||||
permissionService.setPermission(dirRef.getStoreRef(), currentUser, WCMUtil.ROLE_CONTENT_MANAGER, true);
|
||||
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.ALL_PERMISSIONS, true);
|
||||
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
// apply the manager role permission for each manager in the web project
|
||||
for (String manager : managers)
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), manager, WCMUtil.ROLE_CONTENT_MANAGER, true);
|
||||
}
|
||||
|
||||
// tag the store with the store type
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
SandboxConstants.PROP_SANDBOX_AUTHOR_PREVIEW,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with its own store name for querying.
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
QName.createQName(null, SandboxConstants.PROP_SANDBOX_STORE_PREFIX + previewStoreName),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the DNS name property
|
||||
tagStoreDNSPath(avmService, previewStoreName, storeId, username, "preview");
|
||||
|
||||
// The preview user store depends on the main user store (dist=1)
|
||||
tagStoreBackgroundLayer(avmService,previewStoreName, userStoreName,1);
|
||||
|
||||
// The preview user store depends on the main staging store (dist=2)
|
||||
tagStoreBackgroundLayer(avmService,previewStoreName, stagingStoreName,2);
|
||||
|
||||
|
||||
// snapshot the store
|
||||
avmService.createSnapshot(previewStoreName, null, null);
|
||||
|
||||
|
||||
// tag all related stores to indicate that they are part of a single sandbox
|
||||
QName sandboxIdProp = QName.createQName(null, SandboxConstants.PROP_SANDBOXID + GUID.generate());
|
||||
avmService.setStoreProperty(userStoreName,
|
||||
sandboxIdProp,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
sandboxIdProp,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
dumpStoreProperties(avmService, userStoreName);
|
||||
dumpStoreProperties(avmService, previewStoreName);
|
||||
}
|
||||
return new SandboxInfo( new String[] { userStoreName, previewStoreName } );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a workflow sandbox for the named store.
|
||||
*
|
||||
* Various store meta-data properties are set including:
|
||||
* Identifier for store-types: .sandbox.workflow.main and .sandbox.workflow.preview
|
||||
* Store-id: .sandbox-id.<guid> (unique across all stores in the sandbox)
|
||||
* DNS: .dns.<store> = <path-to-webapps-root>
|
||||
* Website Name: .website.name = website name
|
||||
*
|
||||
* @param storeId The id of the store to create a sandbox for
|
||||
* @return Information about the sandbox
|
||||
*/
|
||||
public SandboxInfo createWorkflowSandbox(final String storeId)
|
||||
{
|
||||
final String stagingStoreName = WCMUtil.buildStagingStoreName(storeId);
|
||||
|
||||
// create the workflow 'main' store
|
||||
final String packageName = WCMUtil.STORE_WORKFLOW + "-" + GUID.generate();
|
||||
final String mainStoreName = WCMUtil.buildWorkflowMainStoreName(storeId, packageName);
|
||||
|
||||
avmService.createStore(mainStoreName);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Created workflow sandbox store: " + mainStoreName);
|
||||
}
|
||||
|
||||
// create a layered directory pointing to 'www' in the staging area
|
||||
avmService.createLayeredDirectory(WCMUtil.buildStoreRootPath(stagingStoreName),
|
||||
mainStoreName + ":/",
|
||||
JNDIConstants.DIR_DEFAULT_WWW);
|
||||
|
||||
// tag the store with the store type
|
||||
avmService.setStoreProperty(mainStoreName,
|
||||
SandboxConstants.PROP_SANDBOX_WORKFLOW_MAIN,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the base name of the website so that corresponding
|
||||
// staging areas can be found.
|
||||
avmService.setStoreProperty(mainStoreName,
|
||||
SandboxConstants.PROP_WEBSITE_NAME,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, storeId));
|
||||
|
||||
// tag the store, oddly enough, with its own store name for querying.
|
||||
avmService.setStoreProperty(mainStoreName,
|
||||
QName.createQName(null, SandboxConstants.PROP_SANDBOX_STORE_PREFIX + mainStoreName),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the DNS name property
|
||||
tagStoreDNSPath(avmService, mainStoreName, storeId, packageName);
|
||||
|
||||
|
||||
// The main workflow store depends on the main staging store (dist=1)
|
||||
tagStoreBackgroundLayer(avmService,mainStoreName, stagingStoreName ,1);
|
||||
|
||||
// snapshot the store
|
||||
avmService.createSnapshot(mainStoreName, null, null);
|
||||
|
||||
// create the workflow 'preview' store
|
||||
final String previewStoreName = WCMUtil.buildWorkflowPreviewStoreName(storeId, packageName);
|
||||
|
||||
avmService.createStore(previewStoreName);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Created workflow sandbox preview store: " + previewStoreName);
|
||||
}
|
||||
|
||||
// create a layered directory pointing to 'www' in the workflow 'main' store
|
||||
avmService.createLayeredDirectory(WCMUtil.buildStoreRootPath(mainStoreName),
|
||||
previewStoreName + ":/",
|
||||
JNDIConstants.DIR_DEFAULT_WWW);
|
||||
|
||||
// tag the store with the store type
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
SandboxConstants.PROP_SANDBOX_WORKFLOW_PREVIEW,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with its own store name for querying.
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
QName.createQName(null,
|
||||
SandboxConstants.PROP_SANDBOX_STORE_PREFIX + previewStoreName),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
// tag the store with the DNS name property
|
||||
tagStoreDNSPath(avmService, previewStoreName, storeId, packageName, "preview");
|
||||
|
||||
|
||||
// The preview worfkflow store depends on the main workflow store (dist=1)
|
||||
tagStoreBackgroundLayer(avmService,previewStoreName, mainStoreName,1);
|
||||
|
||||
// The preview workflow store depends on the main staging store (dist=2)
|
||||
tagStoreBackgroundLayer(avmService,previewStoreName, stagingStoreName,2);
|
||||
|
||||
|
||||
// snapshot the store
|
||||
avmService.createSnapshot(previewStoreName, null, null);
|
||||
|
||||
|
||||
// tag all related stores to indicate that they are part of a single sandbox
|
||||
final QName sandboxIdProp = QName.createQName(SandboxConstants.PROP_SANDBOXID + GUID.generate());
|
||||
avmService.setStoreProperty(mainStoreName,
|
||||
sandboxIdProp,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
avmService.setStoreProperty(previewStoreName,
|
||||
sandboxIdProp,
|
||||
new PropertyValue(DataTypeDefinition.TEXT, null));
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
dumpStoreProperties(avmService, mainStoreName);
|
||||
dumpStoreProperties(avmService, previewStoreName);
|
||||
}
|
||||
return new SandboxInfo( new String[] { mainStoreName, previewStoreName } );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the permissions for the list of sandbox managers applied to a user sandbox.
|
||||
* <p>
|
||||
* Ensures that all managers in the list have full WRITE access to the specified user stores.
|
||||
*
|
||||
* @param storeId The store id of the sandbox to update
|
||||
* @param managers The list of authorities who have ContentManager role in the web project
|
||||
* @param username Username of the user sandbox to update
|
||||
*/
|
||||
public void updateSandboxManagers(final String storeId, final List<String> managers, final String username)
|
||||
{
|
||||
final String userStoreName = WCMUtil.buildUserMainStoreName(storeId, username);
|
||||
final String previewStoreName = WCMUtil.buildUserPreviewStoreName(storeId, username);
|
||||
|
||||
// Apply masks to the stores
|
||||
|
||||
// apply the manager role permission to the user main sandbox for each manager
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, WCMUtil.buildStoreRootPath(userStoreName));
|
||||
for (String manager : managers)
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), manager, WCMUtil.ROLE_CONTENT_MANAGER, true);
|
||||
}
|
||||
|
||||
// apply the manager role permission to the user preview sandbox for each manager
|
||||
dirRef = AVMNodeConverter.ToNodeRef(-1, WCMUtil.buildStoreRootPath(previewStoreName));
|
||||
for (String manager : managers)
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), manager, WCMUtil.ROLE_CONTENT_MANAGER, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag a named store with a DNS path meta-data attribute.
|
||||
* The DNS meta-data attribute is set to the system path 'store:/www/avm_webapps'
|
||||
*
|
||||
* @param store Name of the store to tag
|
||||
*/
|
||||
private static void tagStoreDNSPath(AVMService avmService, String store, String... components)
|
||||
{
|
||||
String path = WCMUtil.buildSandboxRootPath(store);
|
||||
// DNS name mangle the property name - can only contain value DNS characters!
|
||||
String dnsProp = SandboxConstants.PROP_DNS + DNSNameMangler.MakeDNSName(components);
|
||||
avmService.setStoreProperty(store, QName.createQName(null, dnsProp),
|
||||
new PropertyValue(DataTypeDefinition.TEXT, path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tags a store with a property that indicates one of its
|
||||
* backgroundStore layers, and the distance of that layer.
|
||||
* This function must be called separately for each background
|
||||
* store; for example the "mysite--alice--preview" store had
|
||||
* as its immediate background "mysite--alice", which itself had
|
||||
* as its background store "mysite", you'd make a sequence of
|
||||
* calls like this:
|
||||
*
|
||||
* <pre>
|
||||
* tagStoreBackgroundLayer("mysite--alice", "mysite", 1);
|
||||
* tagStoreBackgroundLayer("mysite--alice--preview", "mysite--alice", 1);
|
||||
* tagStoreBackgroundLayer("mysite--alice--preview", "mysite", 2);
|
||||
* </pre>
|
||||
*
|
||||
* This make it easy for other parts of the system to determine
|
||||
* which stores depend on others directly or indirectly (which is
|
||||
* useful for reloading virtualized webapps).
|
||||
*
|
||||
* @param store Name of the store to tag
|
||||
* @param backgroundStore Name of store's background store
|
||||
* @param distance Distance from store.
|
||||
* The backgroundStore 'mysite' is 1 away from the store 'mysite--alice'
|
||||
* but 2 away from the store 'mysite--alice--preview'.
|
||||
*/
|
||||
private static void tagStoreBackgroundLayer(AVMService avmService,
|
||||
String store,
|
||||
String backgroundStore,
|
||||
int distance)
|
||||
{
|
||||
String prop_key = SandboxConstants.PROP_BACKGROUND_LAYER + backgroundStore;
|
||||
avmService.setStoreProperty(store, QName.createQName(null, prop_key),
|
||||
new PropertyValue(DataTypeDefinition.INT, distance));
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug helper method to dump the properties of a store
|
||||
*
|
||||
* @param store Store name to dump properties for
|
||||
*/
|
||||
private static void dumpStoreProperties(AVMService avmService, String store)
|
||||
{
|
||||
logger.debug("Store " + store);
|
||||
Map<QName, PropertyValue> props = avmService.getStoreProperties(store);
|
||||
for (QName name : props.keySet())
|
||||
{
|
||||
logger.debug(" " + name + ": " + props.get(name));
|
||||
}
|
||||
}
|
||||
}
|
57
source/java/org/alfresco/wcm/sandbox/SandboxInfo.java
Normal file
57
source/java/org/alfresco/wcm/sandbox/SandboxInfo.java
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.wcm.sandbox;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Provides information about a WCM sandbox created by SandboxFactory.
|
||||
*/
|
||||
public final class SandboxInfo implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 3615436375385857404L;
|
||||
|
||||
String [] store_names_;
|
||||
public SandboxInfo(String [] store_names)
|
||||
{
|
||||
store_names_ = store_names;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of names of the stores within this sandbox.
|
||||
* The "main" store should come first in this list;
|
||||
* any other stores should appear in the order that
|
||||
* they are overlaid on "main" (e.g.: any "preview"
|
||||
* layers should come afterward, in "lowest first" order).
|
||||
* <p>
|
||||
* Note: all sandboxes must have a "main" layer.
|
||||
*/
|
||||
public String [] getStoreNames() { return store_names_; }
|
||||
|
||||
/**
|
||||
* The name of the "main" store within this sandbox.
|
||||
*/
|
||||
public String getMainStoreName() { return store_names_[0]; }
|
||||
}
|
716
source/java/org/alfresco/wcm/util/WCMUtil.java
Normal file
716
source/java/org/alfresco/wcm/util/WCMUtil.java
Normal file
@@ -0,0 +1,716 @@
|
||||
/*
|
||||
* 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 protected 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 protected License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General protected 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.wcm.util;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.alfresco.config.JNDIConstants;
|
||||
import org.alfresco.mbeans.VirtServerRegistry;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.alfresco.util.VirtServerUtils;
|
||||
import org.alfresco.wcm.sandbox.SandboxConstants;
|
||||
|
||||
|
||||
/**
|
||||
* Helper methods and constants related to WCM directories, paths and store name manipulation.
|
||||
*
|
||||
* TODO refactor ...
|
||||
*
|
||||
* @author Ariel Backenroth
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class WCMUtil
|
||||
{
|
||||
/**
|
||||
* Extracts the store name from the avm path
|
||||
*
|
||||
* @param avmPath an absolute avm path
|
||||
*
|
||||
* @return the store name
|
||||
*/
|
||||
protected static String getStoreName(final String avmPath)
|
||||
{
|
||||
final int i = avmPath.indexOf(':');
|
||||
if (i == -1)
|
||||
{
|
||||
throw new IllegalArgumentException("path " + avmPath + " does not contain a store");
|
||||
}
|
||||
return avmPath.substring(0, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the web project store id from the (sandbox) store name
|
||||
* <p>
|
||||
* For example, if the (sandbox) store name is: teststore--admin then the web project store id is: teststore
|
||||
* <p>
|
||||
* Note: Although the staging sandbox store name is currently equivalent to the web project store id, it should
|
||||
* be derived using 'buildStagingStoreName'.
|
||||
*
|
||||
* @param storeName the sandbox store id
|
||||
*
|
||||
* @return the web project store id
|
||||
*/
|
||||
protected static String getStoreId(final String storeName)
|
||||
{
|
||||
final int index = storeName.indexOf(WCMUtil.STORE_SEPARATOR);
|
||||
return (index == -1
|
||||
? storeName
|
||||
: storeName.substring(0, index));
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the store id from the avm path
|
||||
*
|
||||
* For example, if the avm path is: teststore--admin:/www/ROOT then the store id is: teststore
|
||||
*
|
||||
* @param avmPath an absolute avm path
|
||||
*
|
||||
* @return the store id.
|
||||
*/
|
||||
protected static String getStoreIdFromPath(final String avmPath)
|
||||
{
|
||||
return getStoreId(getStoreName(avmPath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the store name describes a preview store.
|
||||
*
|
||||
* @param storeName the store name
|
||||
*
|
||||
* @return <tt>true</tt> if the store is a preview store, <tt>false</tt> otherwise.
|
||||
*/
|
||||
protected static boolean isPreviewStore(final String storeName)
|
||||
{
|
||||
return storeName.endsWith(WCMUtil.STORE_SEPARATOR + WCMUtil.STORE_PREVIEW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the store name describes a workflow store.
|
||||
*
|
||||
* @param storeName the store name
|
||||
*
|
||||
* @return <tt>true</tt> if the store is a workflow store, <tt>false</tt> otherwise.
|
||||
*/
|
||||
protected static boolean isWorkflowStore(String storeName)
|
||||
{
|
||||
if (WCMUtil.isPreviewStore(storeName))
|
||||
{
|
||||
storeName = WCMUtil.getCorrespondingMainStoreName(storeName);
|
||||
}
|
||||
|
||||
return storeName.indexOf(STORE_SEPARATOR + STORE_WORKFLOW) != -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the store name describes a user store.
|
||||
*
|
||||
* @param storeName the store name
|
||||
*
|
||||
* @return <tt>true</tt> if the store is a user store, <tt>false</tt> otherwise.
|
||||
*/
|
||||
protected static boolean isUserStore(String storeName)
|
||||
{
|
||||
if (WCMUtil.isPreviewStore(storeName))
|
||||
{
|
||||
storeName = WCMUtil.getCorrespondingMainStoreName(storeName);
|
||||
}
|
||||
return storeName.indexOf(WCMUtil.STORE_SEPARATOR) != -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the store name describes a main store.
|
||||
*
|
||||
* @param storeName the store name
|
||||
*
|
||||
* @return <tt>true</tt> if the store is a main store, <tt>false</tt> otherwise.
|
||||
*/
|
||||
protected static boolean isMainStore(String storeName)
|
||||
{
|
||||
return (storeName.indexOf(WCMUtil.STORE_SEPARATOR) == -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the username from the store name.
|
||||
*
|
||||
* @param storeName the store name
|
||||
*
|
||||
* @return the username associated or <tt>null</tt> if this is a staging store.
|
||||
*/
|
||||
protected static String getUserName(String storeName)
|
||||
{
|
||||
if (WCMUtil.isPreviewStore(storeName))
|
||||
{
|
||||
storeName = WCMUtil.getCorrespondingMainStoreName(storeName);
|
||||
}
|
||||
final int index = storeName.indexOf(WCMUtil.STORE_SEPARATOR);
|
||||
return (index == -1
|
||||
? null
|
||||
: storeName.substring(index + WCMUtil.STORE_SEPARATOR.length()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corresponding main store name if this is a preview store name.
|
||||
*
|
||||
* @param storeName the preview store name.
|
||||
*
|
||||
* @return the corresponding main store name.
|
||||
*
|
||||
* @exception IllegalArgumentException if this is not a preview store name.
|
||||
*/
|
||||
protected static String getCorrespondingMainStoreName(final String storeName)
|
||||
{
|
||||
if (!WCMUtil.isPreviewStore(storeName))
|
||||
{
|
||||
throw new IllegalArgumentException("store " + storeName + " is not a preview store");
|
||||
}
|
||||
return storeName.substring(0,
|
||||
(storeName.length() -
|
||||
(WCMUtil.STORE_SEPARATOR + WCMUtil.STORE_PREVIEW).length()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corresponding preview store name if this is a main store name.
|
||||
*
|
||||
* @param storeName the main store name.
|
||||
*
|
||||
* @return the corresponding preview store name.
|
||||
*
|
||||
* @exception IllegalArgumentException if this is not a main store name.
|
||||
*/
|
||||
protected static String getCorrespondingPreviewStoreName(final String storeName)
|
||||
{
|
||||
if (WCMUtil.isPreviewStore(storeName))
|
||||
{
|
||||
throw new IllegalArgumentException("store " + storeName + " is already a preview store");
|
||||
}
|
||||
return storeName + WCMUtil.STORE_SEPARATOR + WCMUtil.STORE_PREVIEW;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corresponding path in the main store name if this is a path in
|
||||
* a preview store.
|
||||
*
|
||||
* @param avmPath an avm path within the main store.
|
||||
*
|
||||
* @return the corresponding path within the preview store.
|
||||
*
|
||||
* @exception IllegalArgumentException if this is not a path within the preview store.
|
||||
*/
|
||||
protected static String getCorrespondingPathInMainStore(final String avmPath)
|
||||
{
|
||||
String storeName = WCMUtil.getStoreName(avmPath);
|
||||
storeName = WCMUtil.getCorrespondingMainStoreName(storeName);
|
||||
return WCMUtil.getCorrespondingPath(avmPath, storeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corresponding path in the preview store name if this is a path in
|
||||
* a main store.
|
||||
*
|
||||
* @param avmPath an avm path within the main store.
|
||||
*
|
||||
* @return the corresponding path within the preview store.
|
||||
*
|
||||
* @exception IllegalArgumentException if this is not a path within the preview store.
|
||||
*/
|
||||
protected static String getCorrespondingPathInPreviewStore(final String avmPath)
|
||||
{
|
||||
String storeName = WCMUtil.getStoreName(avmPath);
|
||||
storeName = WCMUtil.getCorrespondingPreviewStoreName(storeName);
|
||||
return WCMUtil.getCorrespondingPath(avmPath, storeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corresponding path in the store provided.
|
||||
*
|
||||
* @param avmPath an avm path
|
||||
* @param otherStore the other store to return the corresponding path for
|
||||
*
|
||||
* @return the corresponding path within the supplied store
|
||||
*/
|
||||
protected static String getCorrespondingPath(final String avmPath, final String otherStore)
|
||||
{
|
||||
return (otherStore + ':' + WCMUtil.getStoreRelativePath(avmPath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the main staging store name for the specified store id.
|
||||
*
|
||||
* @param storeId store id to build staging store name for
|
||||
*
|
||||
* @return main staging store name for the specified store id
|
||||
*/
|
||||
protected static String buildStagingStoreName(final String storeId)
|
||||
{
|
||||
ParameterCheck.mandatoryString("storeId", storeId);
|
||||
return storeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preview store name for the specified store id.
|
||||
*
|
||||
* @param storeId store id to build preview store name for
|
||||
*
|
||||
* @return preview store name for the specified store id
|
||||
*/
|
||||
protected static String buildStagingPreviewStoreName(final String storeId)
|
||||
{
|
||||
return (WCMUtil.buildStagingStoreName(storeId) + WCMUtil.STORE_SEPARATOR +
|
||||
WCMUtil.STORE_PREVIEW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user's main store name for a specific username
|
||||
*
|
||||
* @param storeId store id to build user store name for
|
||||
* @param username of the user to build store name for
|
||||
*
|
||||
* @return the main store for the specified user and store id
|
||||
*/
|
||||
protected static String buildUserMainStoreName(final String storeId,
|
||||
final String userName)
|
||||
{
|
||||
ParameterCheck.mandatoryString("userName", userName);
|
||||
return (WCMUtil.buildStagingStoreName(storeId) + WCMUtil.STORE_SEPARATOR +
|
||||
userName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preview store name for a specific username.
|
||||
*
|
||||
* @param storeId store id to build user preview store name for
|
||||
* @param username of the user to build preview store name for
|
||||
*
|
||||
* @return the preview store for the specified user and store id
|
||||
*/
|
||||
protected static String buildUserPreviewStoreName(final String storeId,
|
||||
final String username)
|
||||
{
|
||||
return (WCMUtil.buildUserMainStoreName(storeId, username) + WCMUtil.STORE_SEPARATOR +
|
||||
WCMUtil.STORE_PREVIEW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the store name for a specific workflow Id.
|
||||
*
|
||||
* @param storeId store id to build workflow store name for
|
||||
* @param workflowId of the user to build workflow store name for
|
||||
*
|
||||
* @return the store for the specified workflow and store ids
|
||||
*/
|
||||
protected static String buildWorkflowMainStoreName(final String storeId,
|
||||
final String workflowId)
|
||||
{
|
||||
ParameterCheck.mandatoryString("workflowId", workflowId);
|
||||
return (WCMUtil.buildStagingStoreName(storeId) + WCMUtil.STORE_SEPARATOR +
|
||||
workflowId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preview store name for a specific workflow Id.
|
||||
*
|
||||
* @param storeId store id to build preview workflow store name for
|
||||
* @param workflowId of the user to build preview workflow store name for
|
||||
*
|
||||
* @return the store for the specified preview workflow and store ids
|
||||
*/
|
||||
protected static String buildWorkflowPreviewStoreName(final String storeId,
|
||||
final String workflowId)
|
||||
{
|
||||
return (WCMUtil.buildWorkflowMainStoreName(storeId, workflowId) +
|
||||
WCMUtil.STORE_SEPARATOR + WCMUtil.STORE_PREVIEW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the root path for the specified store name
|
||||
*
|
||||
* eg. mystore -> mystore:/www
|
||||
*
|
||||
* @param storeName store to build root path for
|
||||
*
|
||||
* @return root path for the specified store name
|
||||
*/
|
||||
protected static String buildStoreRootPath(final String storeName)
|
||||
{
|
||||
ParameterCheck.mandatoryString("storeName", storeName);
|
||||
return storeName + ":/" + JNDIConstants.DIR_DEFAULT_WWW;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the root path for the specified sandbox name
|
||||
*
|
||||
* * eg. mystore -> mystore:/www/avm_webapps
|
||||
*
|
||||
* @param storeName store to build root sandbox path for
|
||||
*
|
||||
* @return root sandbox path for the specified store name
|
||||
*/
|
||||
protected static String buildSandboxRootPath(final String storeName)
|
||||
{
|
||||
ParameterCheck.mandatoryString("storeName", storeName);
|
||||
return storeName + ":/" + JNDIConstants.DIR_DEFAULT_WWW_APPBASE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the root webapp path for the specified store and webapp name
|
||||
*
|
||||
* @param storeName store to build root webapp path for
|
||||
* @param webapp webapp folder name
|
||||
*
|
||||
* @return the root webapp path for the specified store and webapp name
|
||||
*/
|
||||
protected static String buildStoreWebappPath(final String storeName, String webApp)
|
||||
{
|
||||
ParameterCheck.mandatoryString("webApp", webApp);
|
||||
return WCMUtil.buildSandboxRootPath(storeName) + '/' + webApp;
|
||||
}
|
||||
|
||||
// TODO refactor ...
|
||||
// assume for now that it is a store name rather than a path - eg. main rather than main:/
|
||||
protected static String buildStoreUrl(AVMService avmService, String storeName, String domain, String port)
|
||||
{
|
||||
ParameterCheck.mandatoryString("storeName", storeName);
|
||||
|
||||
if (domain == null || port == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Domain and port are mandatory.");
|
||||
}
|
||||
|
||||
return MessageFormat.format(JNDIConstants.PREVIEW_SANDBOX_URL,
|
||||
lookupStoreDNS(avmService, storeName),
|
||||
domain,
|
||||
port);
|
||||
}
|
||||
|
||||
protected static String buildWebappUrl(AVMService avmService, final String storeName, final String webApp, String domain, String port)
|
||||
{
|
||||
ParameterCheck.mandatoryString("webApp", webApp);
|
||||
return (webApp.equals(DIR_ROOT)
|
||||
? buildStoreUrl(avmService, storeName, domain, port)
|
||||
: buildStoreUrl(avmService, storeName, domain, port) + '/' + webApp);
|
||||
}
|
||||
|
||||
protected static String buildAssetUrl(String assetPath, String domain, String port, String dns)
|
||||
{
|
||||
ParameterCheck.mandatoryString("assetPath", assetPath);
|
||||
|
||||
if (domain == null || port == null || dns == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Domain, port and dns name are mandatory.");
|
||||
}
|
||||
|
||||
if (assetPath.startsWith(JNDIConstants.DIR_DEFAULT_WWW_APPBASE))
|
||||
{
|
||||
assetPath = assetPath.substring((JNDIConstants.DIR_DEFAULT_WWW_APPBASE).length());
|
||||
}
|
||||
if (assetPath.startsWith('/' + DIR_ROOT))
|
||||
{
|
||||
assetPath = assetPath.substring(('/' + DIR_ROOT).length());
|
||||
}
|
||||
if (assetPath.length() == 0 || assetPath.charAt(0) != '/')
|
||||
{
|
||||
assetPath = '/' + assetPath;
|
||||
}
|
||||
|
||||
return MessageFormat.format(JNDIConstants.PREVIEW_ASSET_URL, dns, domain, port, assetPath);
|
||||
}
|
||||
|
||||
protected static String lookupStoreDNS(AVMService avmService, String store)
|
||||
{
|
||||
ParameterCheck.mandatoryString("store", store);
|
||||
|
||||
final Map<QName, PropertyValue> props =
|
||||
avmService.queryStorePropertyKey(store, QName.createQName(null, SandboxConstants.PROP_DNS + '%'));
|
||||
|
||||
return (props.size() == 1
|
||||
? props.keySet().iterator().next().getLocalName().substring(SandboxConstants.PROP_DNS.length())
|
||||
: null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the provided path to an absolute path within the avm.
|
||||
*
|
||||
* @param parentAVMPath used as the parent path if the provided path
|
||||
* is relative, otherwise used to extract the parent path portion up until
|
||||
* the webapp directory.
|
||||
* @param path a path relative to the parentAVMPath path, or if it is
|
||||
* absolute, it is relative to the sandbox used in the parentAVMPath.
|
||||
*
|
||||
* @return an absolute path within the avm using the paths provided.
|
||||
*/
|
||||
/*
|
||||
protected static String buildPath(final String parentAVMPath,
|
||||
final String path,
|
||||
final PathRelation relation)
|
||||
{
|
||||
String parent = parentAVMPath;
|
||||
if (path == null || path.length() == 0 || ".".equals(path) || "./".equals(path))
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
if (path.charAt(0) == '/')
|
||||
{
|
||||
final Matcher m = relation.pattern().matcher(parent);
|
||||
if (m.matches())
|
||||
{
|
||||
parent = m.group(1);
|
||||
}
|
||||
}
|
||||
else if (parent.charAt(parent.length() - 1) != '/')
|
||||
{
|
||||
parent = parent + '/';
|
||||
}
|
||||
|
||||
return parent + path;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a path relative to the store portion of the avm path.
|
||||
*
|
||||
* @param absoluteAVMPath an absolute path within the avm
|
||||
* @return the path without the store prefix.
|
||||
*/
|
||||
protected static String getStoreRelativePath(final String absoluteAVMPath)
|
||||
{
|
||||
final Matcher m = STORE_RELATIVE_PATH_PATTERN.matcher(absoluteAVMPath);
|
||||
return m.matches() && m.group(1).length() != 0 ? m.group(1) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a path relative to the webapp portion of the avm path.
|
||||
*
|
||||
* @param absoluteAVMPath an absolute path within the avm
|
||||
* @return a relative path within the webapp.
|
||||
*/
|
||||
protected static String getWebappRelativePath(final String absoluteAVMPath)
|
||||
{
|
||||
final Matcher m = WEBAPP_RELATIVE_PATH_PATTERN.matcher(absoluteAVMPath);
|
||||
return m.matches() && m.group(3).length() != 0 ? m.group(3) : "/";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the webapp within the path
|
||||
*
|
||||
* @param absoluteAVMPath the path from which to extract the webapp name
|
||||
*
|
||||
* @return an the webapp name contained within the path or <tt>null</tt>.
|
||||
*/
|
||||
protected static String getWebapp(final String absoluteAVMPath)
|
||||
{
|
||||
final Matcher m = WEBAPP_RELATIVE_PATH_PATTERN.matcher(absoluteAVMPath);
|
||||
return m.matches() && m.group(2).length() != 0 ? m.group(2) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path portion up the webapp
|
||||
*
|
||||
* @param absoluteAVMPath the path from which to extract the webapp path
|
||||
*
|
||||
* @return an absolute avm path to the webapp contained within
|
||||
* the path or <tt>null</tt>.
|
||||
*/
|
||||
protected static String getWebappPath(final String absoluteAVMPath)
|
||||
{
|
||||
final Matcher m = WEBAPP_RELATIVE_PATH_PATTERN.matcher(absoluteAVMPath);
|
||||
return m.matches() && m.group(1).length() != 0 ? m.group(1) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a path relative to the sandbox porition of the avm path.
|
||||
*
|
||||
* @param absoluteAVMPath an absolute path within the avm
|
||||
* @return a relative path within the sandbox.
|
||||
*/
|
||||
protected static String getSandboxRelativePath(final String absoluteAVMPath)
|
||||
{
|
||||
final Matcher m = SANDBOX_RELATIVE_PATH_PATTERN.matcher(absoluteAVMPath);
|
||||
return m.matches() && m.group(2).length() != 0 ? m.group(2) : "/";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path portion up the sandbox
|
||||
*
|
||||
* @param absoluteAVMPath the path from which to extract the sandbox path
|
||||
*
|
||||
* @return an absolute avm path to the sandbox contained within
|
||||
* the path or <tt>null</tt>.
|
||||
*/
|
||||
protected static String getSandboxPath(final String absoluteAVMPath)
|
||||
{
|
||||
final Matcher m = SANDBOX_RELATIVE_PATH_PATTERN.matcher(absoluteAVMPath);
|
||||
return m.matches() && m.group(1).length() != 0 ? m.group(1) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates all directories for a path if they do not already exist.
|
||||
*/
|
||||
/*
|
||||
protected static void makeAllDirectories(AVMService avmService, final String avmDirectoryPath)
|
||||
{
|
||||
// LOGGER.debug("mkdir -p " + avmDirectoryPath);
|
||||
String s = avmDirectoryPath;
|
||||
final Stack<String[]> dirNames = new Stack<String[]>();
|
||||
while (s != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (avmService.lookup(-1, s) != null)
|
||||
{
|
||||
// LOGGER.debug("path " + s + " exists");
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (AVMNotFoundException avmfe)
|
||||
{
|
||||
}
|
||||
final String[] sb = AVMNodeConverter.SplitBase(s);
|
||||
s = sb[0];
|
||||
// LOGGER.debug("pushing " + sb[1]);
|
||||
dirNames.push(sb);
|
||||
}
|
||||
|
||||
while (!dirNames.isEmpty())
|
||||
{
|
||||
final String[] sb = dirNames.pop();
|
||||
// LOGGER.debug("creating " + sb[1] + " in " + sb[0]);
|
||||
avmService.createDirectory(sb[0], sb[1]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Update notification on the virtualisation server webapp as required for the specified path
|
||||
*
|
||||
* @param path Path to match against
|
||||
* @param force True to force update of server even if path does not match
|
||||
*/
|
||||
protected static void updateVServerWebapp(VirtServerRegistry vServerRegistry, String path, boolean force)
|
||||
{
|
||||
if (force || VirtServerUtils.requiresUpdateNotification(path))
|
||||
{
|
||||
final int webappIndex = path.indexOf('/',
|
||||
path.indexOf(JNDIConstants.DIR_DEFAULT_APPBASE) +
|
||||
JNDIConstants.DIR_DEFAULT_APPBASE.length() + 1);
|
||||
|
||||
if (webappIndex != -1)
|
||||
{
|
||||
path = path.substring(0, webappIndex);
|
||||
}
|
||||
vServerRegistry.updateWebapp(-1, path, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removal notification on all the virtualisation server webapp as required by the specified path
|
||||
*
|
||||
* @param path Path to match against
|
||||
* @param force True to force update of server even if path does not match
|
||||
*/
|
||||
protected static void removeAllVServerWebapps(VirtServerRegistry vServerRegistry, String path, boolean force)
|
||||
{
|
||||
if (force || VirtServerUtils.requiresUpdateNotification(path))
|
||||
{
|
||||
final int webappIndex = path.indexOf('/',
|
||||
path.indexOf(JNDIConstants.DIR_DEFAULT_APPBASE) +
|
||||
JNDIConstants.DIR_DEFAULT_APPBASE.length() + 1);
|
||||
|
||||
if (webappIndex != -1)
|
||||
{
|
||||
path = path.substring(0, webappIndex);
|
||||
}
|
||||
vServerRegistry.removeAllWebapps(-1, path, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removal notification on the virtualisation server webapp as required for the specified path
|
||||
*
|
||||
* @param path Path to match against
|
||||
* @param force True to force update of server even if path does not match
|
||||
*/
|
||||
protected static void removeVServerWebapp(VirtServerRegistry vServerRegistry, String path, boolean force)
|
||||
{
|
||||
if (force || VirtServerUtils.requiresUpdateNotification(path))
|
||||
{
|
||||
final int webappIndex = path.indexOf('/',
|
||||
path.indexOf(JNDIConstants.DIR_DEFAULT_APPBASE) +
|
||||
JNDIConstants.DIR_DEFAULT_APPBASE.length() + 1);
|
||||
|
||||
if (webappIndex != -1)
|
||||
{
|
||||
path = path.substring(0, webappIndex);
|
||||
}
|
||||
vServerRegistry.removeWebapp(-1, path, true);
|
||||
}
|
||||
}
|
||||
|
||||
protected static String getWebProjectsPath()
|
||||
{
|
||||
return "/"+SPACES_COMPANY_HOME_CHILDNAME+"/"+SPACES_WCM_CHILDNAME;
|
||||
}
|
||||
|
||||
private static final String SPACES_COMPANY_HOME_CHILDNAME = "app:company_home"; // should match repository property: spaces.company_home.childname
|
||||
private static final String SPACES_WCM_CHILDNAME = "app:wcm"; // should match repository property: spaces.wcm.childname
|
||||
|
||||
// Component Separator.
|
||||
protected static final String STORE_SEPARATOR = "--";
|
||||
|
||||
// names of the stores representing the layers for an AVM website
|
||||
//XXXarielb this should be private
|
||||
protected final static String STORE_WORKFLOW = "workflow";
|
||||
protected final static String STORE_PREVIEW = "preview";
|
||||
|
||||
// servlet default webapp
|
||||
// Note: this webapp is mapped to the URL path ""
|
||||
public final static String DIR_ROOT = "ROOT";
|
||||
|
||||
protected final static String SPACE_ICON_WEBSITE = "space-icon-website";
|
||||
|
||||
// web user role permissions
|
||||
public static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
||||
public static final String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
|
||||
public static final String ROLE_CONTENT_REVIEWER = "ContentReviewer";
|
||||
public static final String ROLE_CONTENT_CONTRIBUTOR = "ContentContributor";
|
||||
|
||||
// pattern for absolute AVM Path
|
||||
private final static Pattern STORE_RELATIVE_PATH_PATTERN =
|
||||
Pattern.compile("[^:]+:(.+)");
|
||||
|
||||
private final static Pattern WEBAPP_RELATIVE_PATH_PATTERN =
|
||||
Pattern.compile("([^:]+:/" + JNDIConstants.DIR_DEFAULT_WWW +
|
||||
"/" + JNDIConstants.DIR_DEFAULT_APPBASE + "/([^/]+))(.*)");
|
||||
|
||||
private final static Pattern SANDBOX_RELATIVE_PATH_PATTERN =
|
||||
Pattern.compile("([^:]+:/" + JNDIConstants.DIR_DEFAULT_WWW +
|
||||
"/" + JNDIConstants.DIR_DEFAULT_APPBASE + ")(.*)");
|
||||
}
|
122
source/java/org/alfresco/wcm/webproject/WebProjectInfo.java
Normal file
122
source/java/org/alfresco/wcm/webproject/WebProjectInfo.java
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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.wcm.webproject;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* Web Project Information
|
||||
*
|
||||
* @author janv
|
||||
*/
|
||||
public interface WebProjectInfo
|
||||
{
|
||||
/**
|
||||
* Get the site node reference
|
||||
*
|
||||
* @return NodeRef site node reference, null if not set
|
||||
*/
|
||||
public NodeRef getNodeRef();
|
||||
|
||||
/**
|
||||
* Get the name
|
||||
*
|
||||
* @return String name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Set the name
|
||||
*
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name);
|
||||
|
||||
/**
|
||||
* Get the web project store id
|
||||
*
|
||||
* @return the web project store id (generated from the passed DNS name)
|
||||
*/
|
||||
public String getStoreId();
|
||||
|
||||
/**
|
||||
* Get the staging store name
|
||||
*
|
||||
* @return String staging store name
|
||||
*/
|
||||
public String getStagingStoreName();
|
||||
|
||||
/**
|
||||
* Get the description
|
||||
*
|
||||
* @return String description
|
||||
*/
|
||||
public String getDescription();
|
||||
|
||||
/**
|
||||
* Set the description
|
||||
*
|
||||
* @param description description
|
||||
*/
|
||||
public void setDescription(String description);
|
||||
|
||||
/**
|
||||
* Get the title
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle();
|
||||
|
||||
/**
|
||||
* Set the title
|
||||
*
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title);
|
||||
|
||||
/**
|
||||
* Get the default webapp
|
||||
*
|
||||
* @return the webapp name
|
||||
*/
|
||||
public String getDefaultWebApp();
|
||||
|
||||
/**
|
||||
* Set the default webapp
|
||||
*
|
||||
* @param webApp the webapp name to set
|
||||
*/
|
||||
public void setDefaultWebApp(String defaultWebApp);
|
||||
|
||||
/**
|
||||
* @return <tt>true</tt> if this web project can also be used as a template
|
||||
*/
|
||||
public boolean isTemplate();
|
||||
|
||||
/**
|
||||
* @param isTemplate set to <tt>true</tt> if this web project can also be used as a template
|
||||
*/
|
||||
public void setIsTemplate(boolean isTemplate);
|
||||
}
|
190
source/java/org/alfresco/wcm/webproject/WebProjectInfoImpl.java
Normal file
190
source/java/org/alfresco/wcm/webproject/WebProjectInfoImpl.java
Normal file
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* 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.wcm.webproject;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.wcm.util.WCMUtil;
|
||||
|
||||
/**
|
||||
* Web Project Information
|
||||
*
|
||||
* @author janv
|
||||
*/
|
||||
public class WebProjectInfoImpl extends WCMUtil implements WebProjectInfo
|
||||
{
|
||||
/** Web Project node reference */
|
||||
private NodeRef nodeRef;
|
||||
|
||||
/** Web Project name */
|
||||
private String name;
|
||||
|
||||
/** Web Project title */
|
||||
private String title;
|
||||
|
||||
/** Web Project description */
|
||||
private String description;
|
||||
|
||||
/** Web Project store id (aka DNS name) */
|
||||
private String wpStoreId;
|
||||
|
||||
/** Web Project default webApp name */
|
||||
private String defaultWebApp;
|
||||
|
||||
/** Web Project true if the web project can also be used as template */
|
||||
private boolean isTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param name name
|
||||
* @param description description
|
||||
* @param nodeRef web project node reference
|
||||
*/
|
||||
/*package*/ WebProjectInfoImpl(String name, String title, String description, String wpStoreId, String defaultWebApp, boolean isTemplate, NodeRef nodeRef)
|
||||
{
|
||||
this.name = name;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.wpStoreId = wpStoreId;
|
||||
this.defaultWebApp = defaultWebApp;
|
||||
this.isTemplate = isTemplate;
|
||||
this.nodeRef = nodeRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the site node reference
|
||||
*
|
||||
* @return NodeRef site node reference, null if not set
|
||||
*/
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name
|
||||
*
|
||||
* @return String name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dnsName
|
||||
*/
|
||||
public String getStoreId()
|
||||
{
|
||||
return wpStoreId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the staging store name
|
||||
*
|
||||
* @return String staging store name
|
||||
*/
|
||||
public String getStagingStoreName()
|
||||
{
|
||||
return WCMUtil.buildStagingStoreName(getStoreId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the description
|
||||
*
|
||||
* @return String description
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the description
|
||||
*
|
||||
* @param description description
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the webApp
|
||||
*/
|
||||
public String getDefaultWebApp()
|
||||
{
|
||||
return defaultWebApp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param webApp the webApp to set
|
||||
*/
|
||||
public void setDefaultWebApp(String defaultWebApp)
|
||||
{
|
||||
this.defaultWebApp = defaultWebApp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the useAsTemplate
|
||||
*/
|
||||
public boolean isTemplate()
|
||||
{
|
||||
return isTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isTemplate the isTemplate to set
|
||||
*/
|
||||
public void setIsTemplate(boolean isTemplate)
|
||||
{
|
||||
this.isTemplate = isTemplate;
|
||||
}
|
||||
}
|
403
source/java/org/alfresco/wcm/webproject/WebProjectService.java
Normal file
403
source/java/org/alfresco/wcm/webproject/WebProjectService.java
Normal file
@@ -0,0 +1,403 @@
|
||||
package org.alfresco.wcm.webproject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
|
||||
/**
|
||||
* Web Project Service fundamental API.
|
||||
* <p>
|
||||
* This service API is designed to support the public facing Web Project APIs.
|
||||
*
|
||||
* @author janv
|
||||
*/
|
||||
public interface WebProjectService
|
||||
{
|
||||
//
|
||||
// Web project operations
|
||||
//
|
||||
|
||||
/**
|
||||
* Create a new web project (with a default ROOT webapp)
|
||||
* <p>
|
||||
* Note: the DNS name will be used to generate the web project store id, which can be subsequently retrieved via WebProjectInfo.getStoreId()
|
||||
*
|
||||
* @param dnsName DNS name (required, must be unique)
|
||||
* @param name name (require, must be unique)
|
||||
* @param title title
|
||||
* @param description description
|
||||
* @return WebProjectInfo the created web project info
|
||||
*/
|
||||
public WebProjectInfo createWebProject(String dnsName, String name, String title, String description);
|
||||
|
||||
/**
|
||||
* Create a new web project (with a default ROOT webapp)
|
||||
* <p>
|
||||
* Note: the DNS name will be used to generate the web project store id, which can be subsequently retrieved via WebProjectInfo.getStoreId()
|
||||
*
|
||||
* @param dnsName DNS name (required, must be unique)
|
||||
* @param name name (required, must be unique)
|
||||
* @param title title
|
||||
* @param description description
|
||||
* @param sourceNodeRef web project node ref to branch from (can be null)
|
||||
* @return WebProjectInfo the created web project info
|
||||
*/
|
||||
public WebProjectInfo createWebProject(String dnsName, String name, String title, String description, NodeRef sourceNodeRef);
|
||||
|
||||
/**
|
||||
* Create a new web project (with given default web app)
|
||||
* <p>
|
||||
* Note: the DNS name will be used to generate the web project store id, which can be subsequently retrieved via WebProjectInfo.getStoreId()
|
||||
*
|
||||
* @param dnsName DNS name (must be unique)
|
||||
* @param name name (must be unique)
|
||||
* @param title title
|
||||
* @param description description
|
||||
* @param defaultWebApp default webapp (if null, will default to ROOT webapp)
|
||||
* @param useAsTemplate <tt>true</tt> if this web project can be used as a template to branch from
|
||||
* @param sourceNodeRef web project node ref to branch from (can be null)
|
||||
* @return WebProjectInfo the created web project info
|
||||
*/
|
||||
public WebProjectInfo createWebProject(String dnsName, String name, String title, String description, String defaultWebApp, boolean useAsTemplate, NodeRef sourceNodeRef);
|
||||
|
||||
/**
|
||||
* Returns the Web Projects container
|
||||
*
|
||||
* @return NodeRef the node ref of the "Web Projects" container node
|
||||
*/
|
||||
public NodeRef getWebProjectsRoot();
|
||||
|
||||
/**
|
||||
* Returns the Web Project for the given AVM path
|
||||
*
|
||||
* @param absoluteAVMPath the AVM path from which to determine the Web Project
|
||||
* @return NodeRef the web project node ref for the path or null if it could not be determined
|
||||
*/
|
||||
public NodeRef findWebProjectNodeFromPath(String absoluteAVMPath);
|
||||
|
||||
/**
|
||||
* Returns the Web Project for the given AVM store name (sandbox store id)
|
||||
*
|
||||
* @param storeName the AVM store name (sandbox store id) from which to determine the Web Project
|
||||
* @return NodeRef the web project node ref for the path or null if it could not be determined
|
||||
*/
|
||||
public NodeRef findWebProjectNodeFromStore(String storeName);
|
||||
|
||||
/**
|
||||
* List the available web projects for the current user
|
||||
*
|
||||
* @return List<WebProjectInfo> list of web project info
|
||||
*/
|
||||
public List<WebProjectInfo> listWebProjects();
|
||||
|
||||
/**
|
||||
* List the web projects for the given user (based on the available web projects for the current user)
|
||||
*
|
||||
* @param userName user name
|
||||
* @return List<WebProjectInfo> list of web project info
|
||||
*/
|
||||
public List<WebProjectInfo> listWebProjects(String userName);
|
||||
|
||||
/**
|
||||
* Return true if web project node ref is a web project
|
||||
*
|
||||
* @param wpNodeRef web project store id
|
||||
* @return boolean true, if web project
|
||||
*/
|
||||
public boolean isWebProject(String wpStoreId);
|
||||
|
||||
/**
|
||||
* Return true if web project node ref is a web project
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @return boolean true, if web project
|
||||
*/
|
||||
public boolean isWebProject(NodeRef wpNodeRef);
|
||||
|
||||
/**
|
||||
* Gets web project info based on the store id of a web project
|
||||
* <p>
|
||||
* Returns null if the web project can not be found
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @return WebProjectInfo web project info
|
||||
*/
|
||||
public WebProjectInfo getWebProject(String wpStoreId);
|
||||
|
||||
/**
|
||||
* Gets web project info based on the DM nodeRef of a web project
|
||||
* <p>
|
||||
* Returns null if the web project can not be found
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @return WebProjectInfo web project info
|
||||
*/
|
||||
public WebProjectInfo getWebProject(NodeRef wpNodeRef);
|
||||
|
||||
/**
|
||||
* Update the web project info
|
||||
* <p>
|
||||
* Note: the nodeRef and storeId (dnsName) of a web project cannot be updated once the web project has been created
|
||||
*
|
||||
* @param wpInfo web project info
|
||||
*/
|
||||
public void updateWebProject(WebProjectInfo wpInfo);
|
||||
|
||||
/**
|
||||
* Delete the web project
|
||||
* <p>
|
||||
* If the web project does not exist, will log a warning and succeed
|
||||
* <p>
|
||||
* Current user must be a content manager for the web project
|
||||
*
|
||||
* @param name web project store id
|
||||
*/
|
||||
public void deleteWebProject(String wpStoreId);
|
||||
|
||||
/**
|
||||
* Delete the web project
|
||||
* <p>
|
||||
* If the web project does not exist, will log a warning and succeed
|
||||
* <p>
|
||||
* Current user must be a content manager for the web project
|
||||
* <p>
|
||||
* Note: this will cascade delete all sandboxes associated with a web project
|
||||
*
|
||||
* @param name web project node ref
|
||||
*/
|
||||
public void deleteWebProject(NodeRef wpNodeRef);
|
||||
|
||||
//
|
||||
// Web app operations
|
||||
//
|
||||
|
||||
/**
|
||||
* Create webapp for the given web project.
|
||||
* <p>
|
||||
* Current user must be a content manager for the web project
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @param name webapp name (must be unique within a web project)
|
||||
* @param description webapp description
|
||||
*/
|
||||
public void createWebApp(String wpStoreId, String name, String description);
|
||||
|
||||
/**
|
||||
* Create webapp for the given web project.
|
||||
* <p>
|
||||
* Current user must be a content manager for the web project
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @param name webapp name (must be unique within a web project)
|
||||
* @param description webapp description
|
||||
*/
|
||||
public void createWebApp(NodeRef wpNodeRef, String name, String description);
|
||||
|
||||
/**
|
||||
* List webapps for the web project
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @return List<String> list of webapp names
|
||||
*/
|
||||
public List<String> listWebApps(String wpStoreId);
|
||||
|
||||
/**
|
||||
* List webapps for the web project
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @return List<String> list of webapp names
|
||||
*/
|
||||
public List<String> listWebApps(NodeRef wpNodeRef);
|
||||
|
||||
/**
|
||||
* Delete webapp from the given web project
|
||||
* <p>
|
||||
* Current user must be a content manager for the web project
|
||||
* <p>
|
||||
* Note: this will cascade delete all assets within a webapp
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @param name webapp name
|
||||
*/
|
||||
public void deleteWebApp(String wpStoreId, String name);
|
||||
|
||||
/**
|
||||
* Delete webapp from the given web project
|
||||
* <p>
|
||||
* Current user must be a content manager for the web project
|
||||
* <p>
|
||||
* Note: this will cascade delete all assets within a webapp
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @param name webapp name
|
||||
*/
|
||||
public void deleteWebApp(NodeRef wpNodeRef, String name);
|
||||
|
||||
//
|
||||
// Web user operations
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if the current user is a manager of this web project
|
||||
* <p>
|
||||
* Note: This includes admin users but does not include the System user
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @return boolean <tt>true</tt> if the user is a manager (role = WCMUtil.ROLE_CONTENT_MANAGER), <tt>false</tt> otherwise
|
||||
*/
|
||||
public boolean isContentManager(String wpStoreId);
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if the current user is a manager of this web project
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @return boolean <tt>true</tt> if the user is a manager (role = WCMUtil.ROLE_CONTENT_MANAGER), <tt>false</tt> otherwise
|
||||
*/
|
||||
public boolean isContentManager(NodeRef wpNodeRef);
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if the user is a manager of this web project
|
||||
* <p>
|
||||
* Note: This includes admin users but does not include the System user
|
||||
*
|
||||
* @param storeName web project store id
|
||||
* @param username user name
|
||||
* @return boolean <tt>true</tt> if the user is a manager, <tt>false</tt> otherwise
|
||||
*/
|
||||
public boolean isContentManager(String wpStoreId, String username);
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if the user is a manager of this web project
|
||||
* <p>
|
||||
* Note: This includes admin users but does not include the System user
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @param userName user name
|
||||
* @return boolean <tt>true</tt> if the user is a manager (role = WCMUtil.ROLE_CONTENT_MANAGER), <tt>false</tt> otherwise
|
||||
*/
|
||||
public boolean isContentManager(NodeRef wpNodeRef, String userName);
|
||||
|
||||
/**
|
||||
* List the web users of the web project
|
||||
* <p>
|
||||
* Current user must be a content manager for the web project
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @return Map<String, String> map of <authority name, role name> pairs
|
||||
*/
|
||||
public Map<String, String> listWebUsers(String wpStoreId);
|
||||
|
||||
/**
|
||||
* List the web users of the web project
|
||||
* <p>
|
||||
* Current user must be a content manager for the web project
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @return Map<String, String> map of <authority name, role name> pairs
|
||||
*/
|
||||
public Map<String, String> listWebUsers(NodeRef wpNodeRef);
|
||||
|
||||
/**
|
||||
* Get the number of web users invited to this web project
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @return int number of invited web users
|
||||
*/
|
||||
public int getWebUserCount(NodeRef wpNodeRef);
|
||||
|
||||
/**
|
||||
* Gets the role of the specified user
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @param userName user name
|
||||
* @return String web project role for this user, null if no assigned role
|
||||
*/
|
||||
public String getWebUserRole(String wpStoreId, String userName);
|
||||
|
||||
/**
|
||||
* Gets the role of the specified user
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @param userName user name
|
||||
* @return String web project role for this user, null if no assigned role
|
||||
*/
|
||||
public String getWebUserRole(NodeRef wpNodeRef, String userName);
|
||||
|
||||
/**
|
||||
* Indicates whether given user is a web user of the web project or not
|
||||
*
|
||||
* @param store id web project store id
|
||||
* @param userName user name
|
||||
* @return boolean <tt>true</tt> if the user is a web user of the web project, <tt>false</tt> otherwise
|
||||
*/
|
||||
public boolean isWebUser(String wpStoreId, String userName);
|
||||
|
||||
/**
|
||||
* Indicates whether given user is a web user of the web project or not
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @param userName user name
|
||||
* @return boolean <tt>true</tt> if the user is a web user of the web project, <tt>false</tt> otherwise
|
||||
*/
|
||||
public boolean isWebUser(NodeRef wpNodeRef, String userName);
|
||||
|
||||
/**
|
||||
* Invite users/groups to web project
|
||||
* <p>
|
||||
* Note: authority name can be user or group, although a group is flattened into a set of users
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @param userGroupRoles map of <authority name, role name> pairs
|
||||
*/
|
||||
public void inviteWebUsersGroups(String wpStoreId, Map<String, String> userGroupRoles);
|
||||
|
||||
/**
|
||||
* Invite users/groups to web project
|
||||
* <p>
|
||||
* Note: authority name can be user or group, although a group is flattened into a set of users
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @param userGroupRoles map of <authority name, role name> pairs
|
||||
*/
|
||||
public void inviteWebUsersGroups(NodeRef wpNodeRef, Map<String, String> userGroupRoles);
|
||||
|
||||
/**
|
||||
* Invite user to web project
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @param userName user name (not a group)
|
||||
* @param userRole web project role
|
||||
*/
|
||||
public void inviteWebUser(String wpStoreId, String userName, String userRole);
|
||||
|
||||
/**
|
||||
* Invite user to web project
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @param userName user name (not a group)
|
||||
* @param userRole web project role
|
||||
*/
|
||||
public void inviteWebUser(NodeRef wpNodeRef, String userName, String userRole);
|
||||
|
||||
/**
|
||||
* Uninvite user from a web project
|
||||
* <p>
|
||||
* Note: this will cascade delete the user's sandboxes without warning (even if there are modified items)
|
||||
*
|
||||
* @param wpStoreId web project store id
|
||||
* @param userName user name
|
||||
*/
|
||||
public void uninviteWebUser(String wpStoreId, String userName);
|
||||
|
||||
/**
|
||||
* Uninvite user from a web project
|
||||
* <p>
|
||||
* Note: this will cascade delete the user's sandboxes without warning (even if there are modified items)
|
||||
*
|
||||
* @param wpNodeRef web project node ref
|
||||
* @param userName user name
|
||||
*/
|
||||
public void uninviteWebUser(NodeRef wpNodeRef, String userName);
|
||||
}
|
1413
source/java/org/alfresco/wcm/webproject/WebProjectServiceImpl.java
Normal file
1413
source/java/org/alfresco/wcm/webproject/WebProjectServiceImpl.java
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
214
source/java/org/alfresco/wcm/webproject/script/WebProject.java
Normal file
214
source/java/org/alfresco/wcm/webproject/script/WebProject.java
Normal file
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* 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.wcm.webproject.script;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.jscript.ScriptableHashMap;
|
||||
import org.alfresco.wcm.webproject.WebProjectInfo;
|
||||
import org.alfresco.wcm.webproject.WebProjectService;
|
||||
|
||||
import com.sun.corba.se.spi.orbutil.fsm.Guard.Result;
|
||||
|
||||
|
||||
/**
|
||||
* WebProject object to expose via JavaScript
|
||||
*
|
||||
*/
|
||||
public class WebProject implements Serializable
|
||||
{
|
||||
public static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
||||
public static final String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
|
||||
public static final String ROLE_CONTENT_REVIEWER = "ContentReviewer";
|
||||
public static final String ROLE_CONTENT_CONTRIBUTOR = "ContentContributor";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2194205151549790079L;
|
||||
|
||||
WebProjectService service;
|
||||
|
||||
WebProjectInfo info;
|
||||
|
||||
private String name;
|
||||
private String title;
|
||||
private String description;
|
||||
private boolean isTemplate;
|
||||
private String webProjectRef;
|
||||
|
||||
/*
|
||||
* Constructor for Outbound WebProjects
|
||||
*/
|
||||
public WebProject(WebProjectInfo info, WebProjectService service)
|
||||
{
|
||||
this.info = info;
|
||||
this.name = info.getName();
|
||||
this.title = info.getTitle();
|
||||
this.description = info.getDescription();
|
||||
this.isTemplate = info.isTemplate();
|
||||
this.webProjectRef = info.getStoreId();
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
if(info != null) {
|
||||
info.setName(name);
|
||||
}
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
if(info != null) {
|
||||
info.setTitle(title);
|
||||
}
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
if(info != null) {
|
||||
info.setDescription(description);
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setTemplate(boolean isTemplate) {
|
||||
this.isTemplate = isTemplate;
|
||||
if(info != null) {
|
||||
info.setIsTemplate(isTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTemplate() {
|
||||
return isTemplate;
|
||||
}
|
||||
|
||||
// read-only property
|
||||
public void setWebProjectRef(String webProjectRef) {
|
||||
this.webProjectRef = webProjectRef;
|
||||
}
|
||||
|
||||
//
|
||||
public String getWebProjectRef() {
|
||||
return webProjectRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete this web project
|
||||
*/
|
||||
public void deleteWebProject()
|
||||
{
|
||||
service.deleteWebProject(webProjectRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* update this web project
|
||||
*/
|
||||
public void save()
|
||||
{
|
||||
service.updateWebProject(info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a user's role on this site.
|
||||
* <p>
|
||||
* If the user is not a member of the site then null is returned.
|
||||
*
|
||||
* @param userName user name
|
||||
* @return String user's role or null if not a member
|
||||
*/
|
||||
public String getMembersRole(String userName)
|
||||
{
|
||||
return service.getWebUserRole(webProjectRef, userName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the membership details for a user.
|
||||
* <p>
|
||||
* If the user is not already a member of the web project then they are invited with the role
|
||||
* given.
|
||||
* <p>
|
||||
* Only a content manager can modify memberships and there must be at least one conttent manager at
|
||||
* all times.
|
||||
*
|
||||
* @param userName user name
|
||||
* @param role site role
|
||||
*/
|
||||
public void addMembership(String userName, String role)
|
||||
{
|
||||
service.inviteWebUser(webProjectRef, userName, role);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a users membership of the web project.
|
||||
*
|
||||
* Note: this will cascade delete the user's sandboxes without warning (even if there are modified items)
|
||||
* <p>
|
||||
*
|
||||
* @param userName user name
|
||||
*/
|
||||
public void removeMembership(String userName)
|
||||
{
|
||||
service.uninviteWebUser(webProjectRef, userName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a map of members of the web project with their role within the web project.
|
||||
* <p>
|
||||
* @return ScriptableHashMap<String, String> list of members of site with their roles
|
||||
*/
|
||||
public ScriptableHashMap<String, String> listMembers()
|
||||
{
|
||||
Map<String, String> members = service.listWebUsers(webProjectRef);
|
||||
|
||||
ScriptableHashMap<String, String> result = new ScriptableHashMap<String, String>();
|
||||
result.putAll(members);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* List the role (name) for a WCM project
|
||||
* @return the roles for a WCM project
|
||||
*/
|
||||
public ScriptableHashMap<String, String> getRoles()
|
||||
{
|
||||
// TODO Not yet implemented.
|
||||
ScriptableHashMap<String, String> result = new ScriptableHashMap<String, String>();
|
||||
return result;
|
||||
}
|
||||
}
|
134
source/java/org/alfresco/wcm/webproject/script/WebProjects.java
Normal file
134
source/java/org/alfresco/wcm/webproject/script/WebProjects.java
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* 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.wcm.webproject.script;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
|
||||
import org.alfresco.repo.model.Repository;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.wcm.webproject.WebProjectInfo;
|
||||
import org.alfresco.wcm.webproject.WebProjectService;
|
||||
|
||||
|
||||
/**
|
||||
* Script object representing the wcm web projects script object.
|
||||
*
|
||||
* This class is the root for the script api to use wcm web projects.
|
||||
*/
|
||||
public class WebProjects extends BaseScopableProcessorExtension
|
||||
{
|
||||
/** Service Registry */
|
||||
private ServiceRegistry serviceRegistry;
|
||||
|
||||
/** The site service */
|
||||
private WebProjectService webProjectService;
|
||||
|
||||
/**
|
||||
* Sets the Service Registry
|
||||
*
|
||||
* @param serviceRegistry
|
||||
*/
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the wcm web project service
|
||||
*
|
||||
* @param webProjectService the wcm web project service
|
||||
*/
|
||||
public void setWebProjectService(WebProjectService webProjectService)
|
||||
{
|
||||
this.webProjectService = webProjectService;
|
||||
}
|
||||
|
||||
/**
|
||||
* create web project
|
||||
* @param name
|
||||
* @param title
|
||||
* @param description
|
||||
* @return
|
||||
*/
|
||||
public WebProject createWebProject(String dnsName, String name, String title, String description )
|
||||
{
|
||||
WebProjectInfo info = webProjectService.createWebProject(dnsName, name, title, description);
|
||||
return new WebProject(info, webProjectService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an existing wcm web project
|
||||
* @param webProjectRef
|
||||
* @return the wcm web project
|
||||
*/
|
||||
public WebProject getWebProject(String webProjectRef)
|
||||
{
|
||||
WebProjectInfo info = webProjectService.getWebProject(webProjectRef);
|
||||
|
||||
if(info != null){
|
||||
WebProject retVal = new WebProject(info, webProjectService);
|
||||
return retVal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* list All Web Projects
|
||||
*/
|
||||
public WebProject[] listWebProjects()
|
||||
{
|
||||
|
||||
List<WebProjectInfo> projects = webProjectService.listWebProjects();
|
||||
|
||||
WebProject[] ret = new WebProject[projects.size()];
|
||||
|
||||
int i= 0;
|
||||
for(WebProjectInfo info : projects)
|
||||
{
|
||||
ret[i++] = new WebProject(info, webProjectService);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* list All Web Projects which have the userName as a member
|
||||
*/
|
||||
public WebProject[] listWebProjects(String userName)
|
||||
{
|
||||
|
||||
List<WebProjectInfo> projects = webProjectService.listWebProjects(userName);
|
||||
|
||||
WebProject[] ret = new WebProject[projects.size()];
|
||||
|
||||
int i= 0;
|
||||
for(WebProjectInfo info : projects)
|
||||
{
|
||||
ret[i++] = new WebProject(info, webProjectService);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user