mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
11375: MT - complete fix for ETHREEOH-189 11378: Supporting changes for license component in 3.0 (but not the license component itself ...) 11380: Fix for transaction error. ETHREEOH-451. 11383: Oracle upgrade and create SQL fixes (Can Entperprise-only later) 11384: Fix truelicense classpath in sdk-projects git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12424 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -166,7 +166,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="systemBootstrap" parent="systemStoreImporter" singleton="false">
|
<bean id="systemBootstrap" parent="systemStoreImporter" singleton="true">
|
||||||
<property name="bootstrapViews">
|
<property name="bootstrapViews">
|
||||||
<list>
|
<list>
|
||||||
<props>
|
<props>
|
||||||
@@ -398,15 +398,41 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Descriptor Service -->
|
<bean id="personDaoBootstrap" class="org.alfresco.repo.security.person.PersonDaoBootstrap" >
|
||||||
|
<property name="personDaoImpl">
|
||||||
|
<ref bean="personDaoImpl"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Descriptor Service -->
|
||||||
<bean id="descriptorComponent" class="org.alfresco.repo.descriptor.DescriptorServiceImpl">
|
<bean id="descriptorComponent" class="org.alfresco.repo.descriptor.DescriptorServiceImpl">
|
||||||
|
<property name="serverDescriptorDAO">
|
||||||
|
<ref bean="serverDescriptorDAO"/>
|
||||||
|
</property>
|
||||||
|
<property name="currentRepoDescriptorDAO">
|
||||||
|
<ref bean="currentRepoDescriptorDAO"/>
|
||||||
|
</property>
|
||||||
|
<property name="installedRepoDescriptorDAO">
|
||||||
|
<ref bean="installedRepoDescriptorDAO"/>
|
||||||
|
</property>
|
||||||
|
<property name="transactionService">
|
||||||
|
<ref bean="transactionService"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="serverDescriptorDAO" class="org.alfresco.repo.descriptor.ServerDescriptorDAOImpl">
|
||||||
<property name="repositoryName">
|
<property name="repositoryName">
|
||||||
<value>${repository.name}</value>
|
<value>${repository.name}</value>
|
||||||
</property>
|
</property>
|
||||||
<property name="descriptor">
|
<property name="resource">
|
||||||
<value>classpath:alfresco/version.properties</value>
|
<value>classpath:alfresco/version.properties</value>
|
||||||
</property>
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="currentRepoDescriptorDAO" class="org.alfresco.repo.descriptor.RepositoryDescriptorDAOImpl">
|
||||||
|
<property name="name">
|
||||||
|
<value>system.descriptor.current.childname</value>
|
||||||
|
</property>
|
||||||
<property name="systemBootstrap">
|
<property name="systemBootstrap">
|
||||||
<ref bean="systemBootstrap"/>
|
<ref bean="systemBootstrap"/>
|
||||||
</property>
|
</property>
|
||||||
@@ -419,11 +445,39 @@
|
|||||||
<property name="nodeService">
|
<property name="nodeService">
|
||||||
<ref bean="nodeService"/>
|
<ref bean="nodeService"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contentService">
|
||||||
|
<ref bean="contentService"/>
|
||||||
|
</property>
|
||||||
<property name="searchService">
|
<property name="searchService">
|
||||||
<ref bean="searchService"/>
|
<ref bean="searchService"/>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="installedRepoDescriptorDAO" class="org.alfresco.repo.descriptor.RepositoryDescriptorDAOImpl">
|
||||||
|
<property name="name">
|
||||||
|
<value>system.descriptor.childname</value>
|
||||||
|
</property>
|
||||||
|
<property name="systemBootstrap">
|
||||||
|
<ref bean="systemBootstrap"/>
|
||||||
|
</property>
|
||||||
|
<property name="transactionService">
|
||||||
|
<ref bean="transactionService"/>
|
||||||
|
</property>
|
||||||
|
<property name="namespaceService">
|
||||||
|
<ref bean="namespaceService"/>
|
||||||
|
</property>
|
||||||
|
<property name="nodeService">
|
||||||
|
<ref bean="nodeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="contentService">
|
||||||
|
<ref bean="contentService"/>
|
||||||
|
</property>
|
||||||
|
<property name="searchService">
|
||||||
|
<ref bean="searchService"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
<!-- This component checks the interconnection between the metadata, indexes and content -->
|
<!-- This component checks the interconnection between the metadata, indexes and content -->
|
||||||
<bean id="configurationChecker" class="org.alfresco.repo.admin.ConfigurationChecker">
|
<bean id="configurationChecker" class="org.alfresco.repo.admin.ConfigurationChecker">
|
||||||
<property name="strict">
|
<property name="strict">
|
||||||
|
@@ -64,8 +64,6 @@ CREATE INDEX fk_alf_txn_svr ON alf_transaction (server_id);
|
|||||||
|
|
||||||
CREATE INDEX fk_alf_usaged_n ON alf_usage_delta (node_id);
|
CREATE INDEX fk_alf_usaged_n ON alf_usage_delta (node_id);
|
||||||
|
|
||||||
CREATE INDEX fk_alf_vc_store ON alf_version_count (store_id);
|
|
||||||
|
|
||||||
CREATE INDEX fk_avm_nasp_n ON avm_aspects (node_id);
|
CREATE INDEX fk_avm_nasp_n ON avm_aspects (node_id);
|
||||||
|
|
||||||
CREATE INDEX fk_avm_ce_child ON avm_child_entries (child_id);
|
CREATE INDEX fk_avm_ce_child ON avm_child_entries (child_id);
|
||||||
|
@@ -4,6 +4,7 @@ patch.service.not_relevant=Not relevant to schema {0}
|
|||||||
patch.executer.checking=Checking for patches to apply ...
|
patch.executer.checking=Checking for patches to apply ...
|
||||||
patch.service.applying_patch=\tApplying patch ''{0}'' ({1}).
|
patch.service.applying_patch=\tApplying patch ''{0}'' ({1}).
|
||||||
patch.progress=\t\tPatch {0}% complete, estimated complete at {1}.
|
patch.progress=\t\tPatch {0}% complete, estimated complete at {1}.
|
||||||
|
patch.validation.failed=Validation of patch ''{0}'' failed. Patch is applicable to a newer schema than the schema of this build ({1}).\nfixesToSchema: {2}\ntargetSchema: {3}.\nIf this patch should always be run once on every installation, please ensure that the ''fixesToSchema'' value is set to '''${version.schema}'''.
|
||||||
patch.executer.no_patches_required=No patches were required.
|
patch.executer.no_patches_required=No patches were required.
|
||||||
patch.executer.system_readonly=Patches cannot be applied to a read-only system. Possible incompatibilities may exist between the application code and the existing data.
|
patch.executer.system_readonly=Patches cannot be applied to a read-only system. Possible incompatibilities may exist between the application code and the existing data.
|
||||||
patch.executer.not_executed =\n=== Recorded patch (not executed) === \nID: {0}\nRESULT: \n{1}\n=====================================
|
patch.executer.not_executed =\n=== Recorded patch (not executed) === \nID: {0}\nRESULT: \n{1}\n=====================================
|
||||||
|
@@ -17,12 +17,18 @@
|
|||||||
<property name="dictionaryService">
|
<property name="dictionaryService">
|
||||||
<ref bean="dictionaryService"/>
|
<ref bean="dictionaryService"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="tenantService">
|
||||||
|
<ref bean="tenantService"/>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="unboundPolicyBehaviourFilter" class="org.alfresco.repo.policy.BehaviourFilterImpl">
|
<bean id="unboundPolicyBehaviourFilter" class="org.alfresco.repo.policy.BehaviourFilterImpl">
|
||||||
<property name="dictionaryService">
|
<property name="dictionaryService">
|
||||||
<ref bean="dictionaryService"/>
|
<ref bean="dictionaryService"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="tenantService">
|
||||||
|
<ref bean="tenantService"/>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="policyComponent" class="org.alfresco.repo.policy.PolicyComponentImpl">
|
<bean id="policyComponent" class="org.alfresco.repo.policy.PolicyComponentImpl">
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Labs version information
|
# Enterprise version information
|
||||||
#
|
#
|
||||||
|
|
||||||
# Version label
|
# Version label
|
||||||
|
@@ -106,9 +106,7 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
licenseService = (LicenseService) ctx.getBean("org.alfresco.license.LicenseComponent");
|
licenseService = (LicenseService) ctx.getBean("org.alfresco.license.LicenseComponent");
|
||||||
|
readOnly = !licenseService.isLicenseValid();
|
||||||
// verify license, but only if license component is installed
|
|
||||||
licenseService.verifyLicense();
|
|
||||||
}
|
}
|
||||||
catch (NoSuchBeanDefinitionException e)
|
catch (NoSuchBeanDefinitionException e)
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
* As a special exception to the terms and conditions of version 2.0 of
|
* 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
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
* FLOSS exception. You should have recieved a copy of the text describing
|
* FLOSS exception. You should have received a copy of the text describing
|
||||||
* the FLOSS exception, and it is also available here:
|
* the FLOSS exception, and it is also available here:
|
||||||
* http://www.alfresco.com/legal/licensing"
|
* http://www.alfresco.com/legal/licensing"
|
||||||
*/
|
*/
|
||||||
@@ -77,7 +77,7 @@ public class PatchExecuter extends AbstractLifecycleBean
|
|||||||
public void applyOutstandingPatches()
|
public void applyOutstandingPatches()
|
||||||
{
|
{
|
||||||
// Avoid read-only systems
|
// Avoid read-only systems
|
||||||
if (transactionService.isReadOnly())
|
if (!patchService.validatePatches() || transactionService.isReadOnly())
|
||||||
{
|
{
|
||||||
logger.warn(I18NUtil.getMessage(MSG_SYSTEM_READ_ONLY));
|
logger.warn(I18NUtil.getMessage(MSG_SYSTEM_READ_ONLY));
|
||||||
return;
|
return;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
* As a special exception to the terms and conditions of version 2.0 of
|
* 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
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
* FLOSS exception. You should have recieved a copy of the text describing
|
* FLOSS exception. You should have received a copy of the text describing
|
||||||
* the FLOSS exception, and it is also available here:
|
* the FLOSS exception, and it is also available here:
|
||||||
* http://www.alfresco.com/legal/licensing"
|
* http://www.alfresco.com/legal/licensing"
|
||||||
*/
|
*/
|
||||||
@@ -27,11 +27,12 @@ package org.alfresco.repo.admin.patch;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages patches applied against the repository.
|
* Manages patches applied against the repository.
|
||||||
* <p>
|
* <p>
|
||||||
* Patches are injected into this class and any attempted applications are recorded
|
* Patches are injected into this class and any attempted applications are recorded for later auditing.
|
||||||
* for later auditing.
|
|
||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
@@ -41,25 +42,35 @@ public interface PatchService
|
|||||||
/**
|
/**
|
||||||
* Registers a patch with the service that executes them.
|
* Registers a patch with the service that executes them.
|
||||||
*
|
*
|
||||||
* @param patch the patch to register
|
* @param patch
|
||||||
|
* the patch to register
|
||||||
*/
|
*/
|
||||||
public void registerPatch(Patch patch);
|
public void registerPatch(Patch patch);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply all outstanding patches that are relevant to the repo.
|
* Does some up-front validation on the patches, specifically to see if they all apply to the current server version
|
||||||
* If there is a failure, then the patches that were applied will remain so,
|
* and not some future version. This is to prevent tampering with versioning information attached to a license.
|
||||||
* but the process will not attempt to apply any further patches.
|
|
||||||
*
|
*
|
||||||
* @return Returns true if all outstanding patches were applied, or false if the process
|
* @return true if validation is successful. Outputs errors and returns false otherwise.
|
||||||
* was termintated before all patches could be applied.
|
*/
|
||||||
|
public boolean validatePatches();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply all outstanding patches that are relevant to the repo. If there is a failure, then the patches that were
|
||||||
|
* applied will remain so, but the process will not attempt to apply any further patches.
|
||||||
|
*
|
||||||
|
* @return Returns true if all outstanding patches were applied, or false if the process was termintated before all
|
||||||
|
* patches could be applied.
|
||||||
*/
|
*/
|
||||||
public boolean applyOutstandingPatches();
|
public boolean applyOutstandingPatches();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all applied patches between two specific times.
|
* Retrieves all applied patches between two specific times.
|
||||||
*
|
*
|
||||||
* @param from the start date of the search, or null to get all patches from the start
|
* @param from
|
||||||
* @param to the end date of the search, or null to g
|
* the start date of the search, or null to get all patches from the start
|
||||||
|
* @param to
|
||||||
|
* the end date of the search, or null to g
|
||||||
* @return Returns all applied patches (successful or not)
|
* @return Returns all applied patches (successful or not)
|
||||||
*/
|
*/
|
||||||
public List<PatchInfo> getPatches(Date fromDate, Date toDate);
|
public List<PatchInfo> getPatches(Date fromDate, Date toDate);
|
||||||
|
@@ -34,12 +34,12 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.alfresco.i18n.I18NUtil;
|
import org.alfresco.i18n.I18NUtil;
|
||||||
import org.alfresco.repo.domain.AppliedPatch;
|
import org.alfresco.repo.domain.AppliedPatch;
|
||||||
|
import org.alfresco.repo.transaction.TransactionServiceImpl;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.cmr.admin.PatchException;
|
import org.alfresco.service.cmr.admin.PatchException;
|
||||||
import org.alfresco.service.cmr.rule.RuleService;
|
import org.alfresco.service.cmr.rule.RuleService;
|
||||||
import org.alfresco.service.descriptor.Descriptor;
|
import org.alfresco.service.descriptor.Descriptor;
|
||||||
import org.alfresco.service.descriptor.DescriptorService;
|
import org.alfresco.service.descriptor.DescriptorService;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@ public class PatchServiceImpl implements PatchService
|
|||||||
private static final String MSG_NOT_RELEVANT = "patch.service.not_relevant";
|
private static final String MSG_NOT_RELEVANT = "patch.service.not_relevant";
|
||||||
private static final String MSG_PRECEEDED_BY_ALTERNATIVE = "patch.service.preceeded_by_alternative";
|
private static final String MSG_PRECEEDED_BY_ALTERNATIVE = "patch.service.preceeded_by_alternative";
|
||||||
private static final String MSG_APPLYING_PATCH = "patch.service.applying_patch";
|
private static final String MSG_APPLYING_PATCH = "patch.service.applying_patch";
|
||||||
|
private static final String MSG_VALIDATION_FAILED = "patch.validation.failed";
|
||||||
|
|
||||||
private static final Date ZERO_DATE = new Date(0L);
|
private static final Date ZERO_DATE = new Date(0L);
|
||||||
private static final Date INFINITE_DATE = new Date(Long.MAX_VALUE);
|
private static final Date INFINITE_DATE = new Date(Long.MAX_VALUE);
|
||||||
@@ -65,7 +66,7 @@ public class PatchServiceImpl implements PatchService
|
|||||||
private static Log logger = LogFactory.getLog(PatchExecuter.class);
|
private static Log logger = LogFactory.getLog(PatchExecuter.class);
|
||||||
|
|
||||||
private DescriptorService descriptorService;
|
private DescriptorService descriptorService;
|
||||||
private TransactionService transactionService;
|
private TransactionServiceImpl transactionService;
|
||||||
private RuleService ruleService;
|
private RuleService ruleService;
|
||||||
private PatchDaoService patchDaoService;
|
private PatchDaoService patchDaoService;
|
||||||
private List<Patch> patches;
|
private List<Patch> patches;
|
||||||
@@ -80,7 +81,7 @@ public class PatchServiceImpl implements PatchService
|
|||||||
this.descriptorService = descriptorService;
|
this.descriptorService = descriptorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTransactionService(TransactionService transactionService)
|
public void setTransactionService(TransactionServiceImpl transactionService)
|
||||||
{
|
{
|
||||||
this.transactionService = transactionService;
|
this.transactionService = transactionService;
|
||||||
}
|
}
|
||||||
@@ -100,6 +101,27 @@ public class PatchServiceImpl implements PatchService
|
|||||||
patches.add(patch);
|
patches.add(patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean validatePatches()
|
||||||
|
{
|
||||||
|
boolean success = true;
|
||||||
|
int serverSchemaVersion = descriptorService.getServerDescriptor().getSchema();
|
||||||
|
for (Patch patch : patches)
|
||||||
|
{
|
||||||
|
if (patch.getFixesToSchema() > serverSchemaVersion)
|
||||||
|
{
|
||||||
|
logger.error(I18NUtil.getMessage(MSG_VALIDATION_FAILED, patch.getId(), serverSchemaVersion, patch
|
||||||
|
.getFixesToSchema(), patch.getTargetSchema()));
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
this.transactionService.setAllowWrite(false);
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean applyOutstandingPatches()
|
public boolean applyOutstandingPatches()
|
||||||
{
|
{
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
|
@@ -195,8 +195,12 @@ public class InternalEhCacheManagerFactoryBean implements FactoryBean, CacheProv
|
|||||||
* @see #initCacheManager()
|
* @see #initCacheManager()
|
||||||
*/
|
*/
|
||||||
public void stop()
|
public void stop()
|
||||||
|
{
|
||||||
|
synchronized (getClass())
|
||||||
{
|
{
|
||||||
InternalEhCacheManagerFactoryBean.getInstance().shutdown();
|
InternalEhCacheManagerFactoryBean.getInstance().shutdown();
|
||||||
|
initialized = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
68
source/java/org/alfresco/repo/descriptor/DescriptorDAO.java
Normal file
68
source/java/org/alfresco/repo/descriptor/DescriptorDAO.java
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* 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 received 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.descriptor;
|
||||||
|
|
||||||
|
import org.alfresco.service.descriptor.Descriptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstracts out the mechanism used to persist repository descriptors.
|
||||||
|
*
|
||||||
|
* @author dward
|
||||||
|
*/
|
||||||
|
public interface DescriptorDAO
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create repository descriptor.
|
||||||
|
*
|
||||||
|
* @return descriptor
|
||||||
|
*/
|
||||||
|
public Descriptor getDescriptor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Push the current server descriptor properties into persistence.
|
||||||
|
*
|
||||||
|
* @param serverDescriptor
|
||||||
|
* the current server descriptor
|
||||||
|
* @return the descriptor
|
||||||
|
*/
|
||||||
|
public Descriptor updateDescriptor(Descriptor serverDescriptor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the license key.
|
||||||
|
*
|
||||||
|
* @return the license key
|
||||||
|
*/
|
||||||
|
public byte[] getLicenseKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update license key.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* the key
|
||||||
|
*/
|
||||||
|
public void updateLicenseKey(final byte[] key);
|
||||||
|
|
||||||
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@@ -18,113 +18,97 @@
|
|||||||
* As a special exception to the terms and conditions of version 2.0 of
|
* 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
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
* FLOSS exception. You should have recieved a copy of the text describing
|
* FLOSS exception. You should have received a copy of the text describing
|
||||||
* the FLOSS exception, and it is also available here:
|
* the FLOSS exception, and it is also available here:
|
||||||
* http://www.alfresco.com/legal/licensing"
|
* http://www.alfresco.com/legal/licensing"
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.descriptor;
|
package org.alfresco.repo.descriptor;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
|
||||||
import org.alfresco.repo.importer.ImporterBootstrap;
|
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
|
||||||
import org.alfresco.service.descriptor.Descriptor;
|
import org.alfresco.service.descriptor.Descriptor;
|
||||||
import org.alfresco.service.descriptor.DescriptorService;
|
import org.alfresco.service.descriptor.DescriptorService;
|
||||||
import org.alfresco.service.license.LicenseDescriptor;
|
import org.alfresco.service.license.LicenseDescriptor;
|
||||||
import org.alfresco.service.license.LicenseException;
|
import org.alfresco.service.license.LicenseException;
|
||||||
import org.alfresco.service.license.LicenseService;
|
import org.alfresco.service.license.LicenseService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.alfresco.util.AbstractLifecycleBean;
|
import org.alfresco.util.AbstractLifecycleBean;
|
||||||
import org.alfresco.util.VersionNumber;
|
import org.alfresco.util.VersionNumber;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of Descriptor Service
|
* Implementation of Descriptor Service.
|
||||||
*
|
*
|
||||||
* @author David Caruana
|
* @author David Caruana
|
||||||
*/
|
*/
|
||||||
public class DescriptorServiceImpl extends AbstractLifecycleBean implements DescriptorService, InitializingBean
|
public class DescriptorServiceImpl extends AbstractLifecycleBean implements DescriptorService, InitializingBean
|
||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(DescriptorServiceImpl.class);
|
|
||||||
|
|
||||||
private String repositoryName;
|
/** The server descriptor DAO. */
|
||||||
private Properties serverProperties;
|
private DescriptorDAO serverDescriptorDAO;
|
||||||
|
|
||||||
private ImporterBootstrap systemBootstrap;
|
/** The current repo descriptor DAO. */
|
||||||
|
private DescriptorDAO currentRepoDescriptorDAO;
|
||||||
|
|
||||||
private NamespaceService namespaceService;
|
/** The installed repo descriptor DAO. */
|
||||||
|
private DescriptorDAO installedRepoDescriptorDAO;
|
||||||
private NodeService nodeService;
|
|
||||||
|
|
||||||
private SearchService searchService;
|
|
||||||
|
|
||||||
|
/** The transaction service. */
|
||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
|
|
||||||
|
/** The license service. */
|
||||||
private LicenseService licenseService = null;
|
private LicenseService licenseService = null;
|
||||||
|
|
||||||
|
/** The server descriptor. */
|
||||||
private Descriptor serverDescriptor;
|
private Descriptor serverDescriptor;
|
||||||
|
|
||||||
|
/** The current repo descriptor. */
|
||||||
private Descriptor currentRepoDescriptor;
|
private Descriptor currentRepoDescriptor;
|
||||||
|
|
||||||
|
/** The installed repo descriptor. */
|
||||||
private Descriptor installedRepoDescriptor;
|
private Descriptor installedRepoDescriptor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the repository properties from a resource file
|
* Sets the server descriptor DAO.
|
||||||
*
|
*
|
||||||
* @param repositoryResource resource containing repository properties
|
* @param serverDescriptorDAO
|
||||||
* @throws IOException
|
* the new server descriptor DAO
|
||||||
*/
|
*/
|
||||||
public void setRepositoryName(String repositoryName)
|
public void setServerDescriptorDAO(DescriptorDAO serverDescriptorDAO)
|
||||||
throws IOException
|
|
||||||
{
|
{
|
||||||
this.repositoryName = repositoryName;
|
this.serverDescriptorDAO = serverDescriptorDAO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the server descriptor from a resource file
|
* Sets the current repo descriptor DAO.
|
||||||
*
|
*
|
||||||
* @param descriptorResource
|
* @param currentRepoDescriptorDAO
|
||||||
* resource containing server descriptor meta-data
|
* the new current repo descriptor DAO
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public void setDescriptor(Resource descriptorResource) throws IOException
|
public void setCurrentRepoDescriptorDAO(DescriptorDAO currentRepoDescriptorDAO)
|
||||||
{
|
{
|
||||||
this.serverProperties = new Properties();
|
this.currentRepoDescriptorDAO = currentRepoDescriptorDAO;
|
||||||
this.serverProperties.load(descriptorResource.getInputStream());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param systemBootstrap
|
* Sets the installed repo descriptor DAO.
|
||||||
* system bootstrap
|
*
|
||||||
|
* @param installedRepoDescriptorDAO
|
||||||
|
* the new installed repo descriptor DAO
|
||||||
*/
|
*/
|
||||||
public void setSystemBootstrap(ImporterBootstrap systemBootstrap)
|
public void setInstalledRepoDescriptorDAO(DescriptorDAO installedRepoDescriptorDAO)
|
||||||
{
|
{
|
||||||
this.systemBootstrap = systemBootstrap;
|
this.installedRepoDescriptorDAO = installedRepoDescriptorDAO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the transaction service.
|
||||||
|
*
|
||||||
* @param transactionService
|
* @param transactionService
|
||||||
* transaction service
|
* transaction service
|
||||||
*/
|
*/
|
||||||
@@ -133,36 +117,8 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
this.transactionService = transactionService;
|
this.transactionService = transactionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param namespaceService
|
|
||||||
* namespace service
|
|
||||||
*/
|
|
||||||
public void setNamespaceService(NamespaceService namespaceService)
|
|
||||||
{
|
|
||||||
this.namespaceService = namespaceService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param nodeService
|
|
||||||
* node service
|
|
||||||
*/
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param searchService
|
|
||||||
* search service
|
|
||||||
*/
|
|
||||||
public void setSearchService(SearchService searchService)
|
|
||||||
{
|
|
||||||
this.searchService = searchService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.DescriptorService#getDescriptor()
|
* @see org.alfresco.service.descriptor.DescriptorService#getDescriptor()
|
||||||
*/
|
*/
|
||||||
public Descriptor getServerDescriptor()
|
public Descriptor getServerDescriptor()
|
||||||
@@ -172,7 +128,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.DescriptorService#getCurrentRepositoryDescriptor()
|
* @see org.alfresco.service.descriptor.DescriptorService#getCurrentRepositoryDescriptor()
|
||||||
*/
|
*/
|
||||||
public Descriptor getCurrentRepositoryDescriptor()
|
public Descriptor getCurrentRepositoryDescriptor()
|
||||||
@@ -180,7 +135,8 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
return currentRepoDescriptor;
|
return currentRepoDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
* @see org.alfresco.service.descriptor.DescriptorService#getRepositoryDescriptor()
|
* @see org.alfresco.service.descriptor.DescriptorService#getRepositoryDescriptor()
|
||||||
*/
|
*/
|
||||||
public Descriptor getInstalledRepositoryDescriptor()
|
public Descriptor getInstalledRepositoryDescriptor()
|
||||||
@@ -190,7 +146,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.DescriptorService#getLicenseDescriptor()
|
* @see org.alfresco.service.descriptor.DescriptorService#getLicenseDescriptor()
|
||||||
*/
|
*/
|
||||||
public LicenseDescriptor getLicenseDescriptor()
|
public LicenseDescriptor getLicenseDescriptor()
|
||||||
@@ -198,6 +153,10 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
return (licenseService == null) ? null : licenseService.getLicense();
|
return (licenseService == null) ? null : licenseService.getLicense();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onBootstrap(ApplicationEvent event)
|
protected void onBootstrap(ApplicationEvent event)
|
||||||
{
|
{
|
||||||
@@ -214,15 +173,22 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
licenseService.verifyLicense();
|
licenseService.verifyLicense();
|
||||||
|
|
||||||
// persist the server descriptor values
|
// persist the server descriptor values
|
||||||
currentRepoDescriptor = updateCurrentRepositoryDescriptor(serverDescriptor);
|
currentRepoDescriptor = DescriptorServiceImpl.this.currentRepoDescriptorDAO
|
||||||
|
.updateDescriptor(serverDescriptor);
|
||||||
|
|
||||||
// create the installed descriptor
|
// create the installed descriptor
|
||||||
return createInstalledRepositoryDescriptor();
|
Descriptor installed = DescriptorServiceImpl.this.installedRepoDescriptorDAO.getDescriptor();
|
||||||
|
return installed == null ? new UnknownDescriptor() : installed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
installedRepoDescriptor = transactionService.getRetryingTransactionHelper().doInTransaction(createDescriptorWork, transactionService.isReadOnly(), false);
|
installedRepoDescriptor = transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||||
|
createDescriptorWork, transactionService.isReadOnly(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.util.AbstractLifecycleBean#onShutdown(org.springframework.context.ApplicationEvent)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onShutdown(ApplicationEvent event)
|
protected void onShutdown(ApplicationEvent event)
|
||||||
{
|
{
|
||||||
@@ -233,158 +199,19 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise Descriptors
|
* Initialise Descriptors.
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
* the exception
|
||||||
*/
|
*/
|
||||||
public void afterPropertiesSet() throws Exception
|
public void afterPropertiesSet() throws Exception
|
||||||
{
|
{
|
||||||
// initialise server descriptor
|
// initialise server descriptor
|
||||||
serverDescriptor = createServerDescriptor();
|
serverDescriptor = this.serverDescriptorDAO.getDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create server descriptor
|
* Initialise License Service.
|
||||||
*
|
|
||||||
* @return descriptor
|
|
||||||
*/
|
|
||||||
private Descriptor createServerDescriptor()
|
|
||||||
{
|
|
||||||
return new ServerDescriptor();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create repository descriptor
|
|
||||||
*
|
|
||||||
* @return descriptor
|
|
||||||
*/
|
|
||||||
private Descriptor createInstalledRepositoryDescriptor()
|
|
||||||
{
|
|
||||||
// retrieve system descriptor location
|
|
||||||
StoreRef storeRef = systemBootstrap.getStoreRef();
|
|
||||||
Properties systemProperties = systemBootstrap.getConfiguration();
|
|
||||||
String path = systemProperties.getProperty("system.descriptor.childname");
|
|
||||||
|
|
||||||
// retrieve system descriptor
|
|
||||||
NodeRef descriptorNodeRef = getDescriptorNodeRef(storeRef, path, false);
|
|
||||||
// create appropriate descriptor
|
|
||||||
if (descriptorNodeRef != null)
|
|
||||||
{
|
|
||||||
Map<QName, Serializable> properties = nodeService.getProperties(descriptorNodeRef);
|
|
||||||
return new RepositoryDescriptor(properties);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// descriptor cannot be found
|
|
||||||
return new UnknownDescriptor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Push the current server descriptor properties into persistence.
|
|
||||||
*
|
|
||||||
* @param serverDescriptor
|
|
||||||
* the current server descriptor
|
|
||||||
*/
|
|
||||||
private Descriptor updateCurrentRepositoryDescriptor(Descriptor serverDescriptor)
|
|
||||||
{
|
|
||||||
// retrieve system descriptor location
|
|
||||||
StoreRef storeRef = systemBootstrap.getStoreRef();
|
|
||||||
Properties systemProperties = systemBootstrap.getConfiguration();
|
|
||||||
String path = systemProperties.getProperty("system.descriptor.current.childname");
|
|
||||||
|
|
||||||
// retrieve system descriptor
|
|
||||||
NodeRef currentDescriptorNodeRef = getDescriptorNodeRef(storeRef, path, true);
|
|
||||||
// if the node is missing but it should have been created
|
|
||||||
if (currentDescriptorNodeRef == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// set the properties
|
|
||||||
if (!transactionService.isReadOnly())
|
|
||||||
{
|
|
||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_NAME, serverDescriptor.getName());
|
|
||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_MAJOR, serverDescriptor.getVersionMajor());
|
|
||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_MINOR, serverDescriptor.getVersionMinor());
|
|
||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_REVISION, serverDescriptor.getVersionRevision());
|
|
||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_LABEL, serverDescriptor.getVersionLabel());
|
|
||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_BUILD, serverDescriptor.getVersionBuild());
|
|
||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_SCHEMA, serverDescriptor.getSchema());
|
|
||||||
Collection<String> editions = new ArrayList<String>();
|
|
||||||
editions.add(serverDescriptor.getEdition());
|
|
||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_EDITION, (Serializable)editions);
|
|
||||||
|
|
||||||
// done
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("Updated current repository descriptor properties: \n" + " node: " + currentDescriptorNodeRef + "\n" + " descriptor: " + serverDescriptor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<QName, Serializable> properties = nodeService.getProperties(currentDescriptorNodeRef);
|
|
||||||
return new RepositoryDescriptor(properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param storeRef
|
|
||||||
* the store to search
|
|
||||||
* @param path
|
|
||||||
* the path below the root node to search
|
|
||||||
* @param create
|
|
||||||
* true if the node must be created if missing. No properties will be set.
|
|
||||||
* @return Returns the node for the path, or null
|
|
||||||
*/
|
|
||||||
private NodeRef getDescriptorNodeRef(StoreRef storeRef, String path, boolean create)
|
|
||||||
{
|
|
||||||
NodeRef descriptorNodeRef = null;
|
|
||||||
String searchPath = "/" + path;
|
|
||||||
|
|
||||||
// check for the store
|
|
||||||
if (nodeService.exists(storeRef))
|
|
||||||
{
|
|
||||||
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
|
|
||||||
List<NodeRef> nodeRefs = searchService.selectNodes(rootNodeRef, searchPath, null, namespaceService, false);
|
|
||||||
if (nodeRefs.size() == 1)
|
|
||||||
{
|
|
||||||
descriptorNodeRef = nodeRefs.get(0);
|
|
||||||
}
|
|
||||||
else if (nodeRefs.size() == 0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else if (nodeRefs.size() > 1)
|
|
||||||
{
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("Multiple descriptors: \n" + " store: " + storeRef + "\n" + " path: " + searchPath);
|
|
||||||
}
|
|
||||||
// get the first one
|
|
||||||
descriptorNodeRef = nodeRefs.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptorNodeRef == null)
|
|
||||||
{
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("Descriptor not found: \n" + " store: " + storeRef + "\n" + " path: " + searchPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create if necessary
|
|
||||||
if (create)
|
|
||||||
{
|
|
||||||
storeRef = nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
|
|
||||||
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
|
|
||||||
descriptorNodeRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName(path, namespaceService),
|
|
||||||
QName.createQName("sys:descriptor", namespaceService)).getChildRef();
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("Created missing descriptor node: " + descriptorNodeRef);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return descriptorNodeRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialise License Service
|
|
||||||
*/
|
*/
|
||||||
private void initialiseLicenseService()
|
private void initialiseLicenseService()
|
||||||
{
|
{
|
||||||
@@ -392,9 +219,15 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
{
|
{
|
||||||
// NOTE: We could tie in the License Component via Spring configuration, but then it could
|
// NOTE: We could tie in the License Component via Spring configuration, but then it could
|
||||||
// be declaratively taken out in an installed environment.
|
// be declaratively taken out in an installed environment.
|
||||||
Class licenseComponentClass = Class.forName("org.alfresco.license.LicenseComponent");
|
Class<?> licenseComponentClass = Class.forName("org.alfresco.license.LicenseComponent");
|
||||||
Constructor constructor = licenseComponentClass.getConstructor(new Class[] { ApplicationContext.class });
|
Constructor<?> constructor = licenseComponentClass.getConstructor(new Class[]
|
||||||
licenseService = (LicenseService) constructor.newInstance(new Object[] { getApplicationContext() });
|
{
|
||||||
|
ApplicationContext.class
|
||||||
|
});
|
||||||
|
licenseService = (LicenseService) constructor.newInstance(new Object[]
|
||||||
|
{
|
||||||
|
getApplicationContext()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e)
|
catch (ClassNotFoundException e)
|
||||||
{
|
{
|
||||||
@@ -427,14 +260,14 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy License Service
|
* Dummy License Service.
|
||||||
*/
|
*/
|
||||||
private class NOOPLicenseService implements LicenseService
|
private class NOOPLicenseService implements LicenseService
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
* @see org.alfresco.service.license.LicenseService#verifyLicense(org.alfresco.service.descriptor.Descriptor,
|
||||||
* @see org.alfresco.service.license.LicenseService#verify()
|
* org.alfresco.service.descriptor.DescriptorDAO)
|
||||||
*/
|
*/
|
||||||
public void verifyLicense() throws LicenseException
|
public void verifyLicense() throws LicenseException
|
||||||
{
|
{
|
||||||
@@ -442,7 +275,15 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
* @see org.alfresco.service.license.LicenseService#isLicenseValid()
|
||||||
|
*/
|
||||||
|
public boolean isLicenseValid()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
* @see org.alfresco.service.license.LicenseService#getLicense()
|
* @see org.alfresco.service.license.LicenseService#getLicense()
|
||||||
*/
|
*/
|
||||||
public LicenseDescriptor getLicense() throws LicenseException
|
public LicenseDescriptor getLicense() throws LicenseException
|
||||||
@@ -450,13 +291,18 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.license.LicenseService#shutdown()
|
||||||
|
*/
|
||||||
public void shutdown()
|
public void shutdown()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unknown descriptor
|
* Unknown descriptor.
|
||||||
*
|
*
|
||||||
* @author David Caruana
|
* @author David Caruana
|
||||||
*/
|
*/
|
||||||
@@ -464,7 +310,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getId()
|
* @see org.alfresco.service.descriptor.Descriptor#getId()
|
||||||
*/
|
*/
|
||||||
public String getId()
|
public String getId()
|
||||||
@@ -472,7 +317,8 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getName()
|
* @see org.alfresco.service.descriptor.Descriptor#getName()
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public String getName()
|
||||||
@@ -480,7 +326,8 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionMajor()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionMajor()
|
||||||
*/
|
*/
|
||||||
public String getVersionMajor()
|
public String getVersionMajor()
|
||||||
@@ -490,7 +337,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionMinor()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionMinor()
|
||||||
*/
|
*/
|
||||||
public String getVersionMinor()
|
public String getVersionMinor()
|
||||||
@@ -500,7 +346,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionRevision()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionRevision()
|
||||||
*/
|
*/
|
||||||
public String getVersionRevision()
|
public String getVersionRevision()
|
||||||
@@ -510,7 +355,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionLabel()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionLabel()
|
||||||
*/
|
*/
|
||||||
public String getVersionLabel()
|
public String getVersionLabel()
|
||||||
@@ -520,7 +364,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionBuild()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionBuild()
|
||||||
*/
|
*/
|
||||||
public String getVersionBuild()
|
public String getVersionBuild()
|
||||||
@@ -528,6 +371,10 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionNumber()
|
||||||
|
*/
|
||||||
public VersionNumber getVersionNumber()
|
public VersionNumber getVersionNumber()
|
||||||
{
|
{
|
||||||
return new VersionNumber("1.0.0");
|
return new VersionNumber("1.0.0");
|
||||||
@@ -535,7 +382,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersion()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersion()
|
||||||
*/
|
*/
|
||||||
public String getVersion()
|
public String getVersion()
|
||||||
@@ -545,7 +391,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getEdition()
|
* @see org.alfresco.service.descriptor.Descriptor#getEdition()
|
||||||
*/
|
*/
|
||||||
public String getEdition()
|
public String getEdition()
|
||||||
@@ -555,7 +400,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getSchema()
|
* @see org.alfresco.service.descriptor.Descriptor#getSchema()
|
||||||
*/
|
*/
|
||||||
public int getSchema()
|
public int getSchema()
|
||||||
@@ -565,7 +409,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getDescriptorKeys()
|
* @see org.alfresco.service.descriptor.Descriptor#getDescriptorKeys()
|
||||||
*/
|
*/
|
||||||
public String[] getDescriptorKeys()
|
public String[] getDescriptorKeys()
|
||||||
@@ -575,7 +418,6 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getDescriptor(java.lang.String)
|
* @see org.alfresco.service.descriptor.Descriptor#getDescriptor(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getDescriptor(String key)
|
public String getDescriptor(String key)
|
||||||
@@ -589,11 +431,19 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
*
|
*
|
||||||
* @author gavinc
|
* @author gavinc
|
||||||
*/
|
*/
|
||||||
public abstract class BaseDescriptor implements Descriptor
|
public static abstract class BaseDescriptor implements Descriptor
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** The version number. */
|
||||||
private VersionNumber versionNumber = null;
|
private VersionNumber versionNumber = null;
|
||||||
|
|
||||||
|
/** The number as a string. */
|
||||||
private String strVersion = null;
|
private String strVersion = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionNumber()
|
||||||
|
*/
|
||||||
public VersionNumber getVersionNumber()
|
public VersionNumber getVersionNumber()
|
||||||
{
|
{
|
||||||
if (this.versionNumber == null)
|
if (this.versionNumber == null)
|
||||||
@@ -609,6 +459,10 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
return this.versionNumber;
|
return this.versionNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersion()
|
||||||
|
*/
|
||||||
public String getVersion()
|
public String getVersion()
|
||||||
{
|
{
|
||||||
if (this.strVersion == null)
|
if (this.strVersion == null)
|
||||||
@@ -661,7 +515,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the int representation of the given schema string
|
* Returns the int representation of the given schema string.
|
||||||
*
|
*
|
||||||
* @param schemaStr
|
* @param schemaStr
|
||||||
* The schema number as a string
|
* The schema number as a string
|
||||||
@@ -689,263 +543,4 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Repository Descriptor whose meta-data is retrieved from the repository store
|
|
||||||
*/
|
|
||||||
private class RepositoryDescriptor extends BaseDescriptor
|
|
||||||
{
|
|
||||||
private Map<QName, Serializable> properties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct
|
|
||||||
*
|
|
||||||
* @param properties
|
|
||||||
* system descriptor properties
|
|
||||||
*/
|
|
||||||
private RepositoryDescriptor(Map<QName, Serializable> properties)
|
|
||||||
{
|
|
||||||
this.properties = properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getId()
|
|
||||||
*/
|
|
||||||
public String getId()
|
|
||||||
{
|
|
||||||
return getDescriptor("sys:node-uuid");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getName()
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return getDescriptor("sys:name");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionMajor()
|
|
||||||
*/
|
|
||||||
public String getVersionMajor()
|
|
||||||
{
|
|
||||||
return getDescriptor("sys:versionMajor");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionMinor()
|
|
||||||
*/
|
|
||||||
public String getVersionMinor()
|
|
||||||
{
|
|
||||||
return getDescriptor("sys:versionMinor");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionRevision()
|
|
||||||
*/
|
|
||||||
public String getVersionRevision()
|
|
||||||
{
|
|
||||||
return getDescriptor("sys:versionRevision");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionLabel()
|
|
||||||
*/
|
|
||||||
public String getVersionLabel()
|
|
||||||
{
|
|
||||||
return getDescriptor("sys:versionLabel");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionBuild()
|
|
||||||
*/
|
|
||||||
public String getVersionBuild()
|
|
||||||
{
|
|
||||||
return getDescriptor("sys:versionBuild");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getEdition()
|
|
||||||
*/
|
|
||||||
public String getEdition()
|
|
||||||
{
|
|
||||||
return getDescriptor("sys:versionEdition");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getSchema()
|
|
||||||
*/
|
|
||||||
public int getSchema()
|
|
||||||
{
|
|
||||||
return getSchema(getDescriptor("sys:versionSchema"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getDescriptorKeys()
|
|
||||||
*/
|
|
||||||
public String[] getDescriptorKeys()
|
|
||||||
{
|
|
||||||
String[] keys = new String[properties.size()];
|
|
||||||
properties.keySet().toArray(keys);
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getDescriptor(java.lang.String)
|
|
||||||
*/
|
|
||||||
public String getDescriptor(String key)
|
|
||||||
{
|
|
||||||
String strValue = null;
|
|
||||||
QName qname = QName.createQName(key, namespaceService);
|
|
||||||
Serializable value = properties.get(qname);
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
if (value instanceof Collection)
|
|
||||||
{
|
|
||||||
Collection coll = (Collection)value;
|
|
||||||
if (coll.size() > 0)
|
|
||||||
{
|
|
||||||
strValue = coll.iterator().next().toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strValue = value.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return strValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Server Descriptor whose meta-data is retrieved from run-time environment
|
|
||||||
*/
|
|
||||||
private class ServerDescriptor extends BaseDescriptor
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getId()
|
|
||||||
*/
|
|
||||||
public String getId()
|
|
||||||
{
|
|
||||||
return "<Unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getName()
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return repositoryName == null ? "<Unknown>" : repositoryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionMajor()
|
|
||||||
*/
|
|
||||||
public String getVersionMajor()
|
|
||||||
{
|
|
||||||
return serverProperties.getProperty("version.major");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionMinor()
|
|
||||||
*/
|
|
||||||
public String getVersionMinor()
|
|
||||||
{
|
|
||||||
return serverProperties.getProperty("version.minor");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionRevision()
|
|
||||||
*/
|
|
||||||
public String getVersionRevision()
|
|
||||||
{
|
|
||||||
return serverProperties.getProperty("version.revision");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionLabel()
|
|
||||||
*/
|
|
||||||
public String getVersionLabel()
|
|
||||||
{
|
|
||||||
return serverProperties.getProperty("version.label");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionBuild()
|
|
||||||
*/
|
|
||||||
public String getVersionBuild()
|
|
||||||
{
|
|
||||||
return serverProperties.getProperty("version.build");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getEdition()
|
|
||||||
*/
|
|
||||||
public String getEdition()
|
|
||||||
{
|
|
||||||
return serverProperties.getProperty("version.edition");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getSchema()
|
|
||||||
*/
|
|
||||||
public int getSchema()
|
|
||||||
{
|
|
||||||
return getSchema(serverProperties.getProperty("version.schema"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getDescriptorKeys()
|
|
||||||
*/
|
|
||||||
public String[] getDescriptorKeys()
|
|
||||||
{
|
|
||||||
String[] keys = new String[serverProperties.size()];
|
|
||||||
serverProperties.keySet().toArray(keys);
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getDescriptor(java.lang.String)
|
|
||||||
*/
|
|
||||||
public String getDescriptor(String key)
|
|
||||||
{
|
|
||||||
return serverProperties.getProperty(key, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,509 @@
|
|||||||
|
/*
|
||||||
|
* 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 received 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.descriptor;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
|
import org.alfresco.repo.descriptor.DescriptorServiceImpl.BaseDescriptor;
|
||||||
|
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
|
import org.alfresco.service.descriptor.Descriptor;
|
||||||
|
import org.alfresco.service.license.LicenseException;
|
||||||
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages persistence and retrieval of Descriptors whose meta-data are retrieved from the repository stores.
|
||||||
|
*
|
||||||
|
* @author dward
|
||||||
|
*/
|
||||||
|
public class RepositoryDescriptorDAOImpl implements DescriptorDAO
|
||||||
|
{
|
||||||
|
|
||||||
|
/** The logger. */
|
||||||
|
private static Log logger = LogFactory.getLog(RepositoryDescriptorDAOImpl.class);
|
||||||
|
|
||||||
|
/** The name. */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** The node service. */
|
||||||
|
private NodeService nodeService;
|
||||||
|
|
||||||
|
/** The content service. */
|
||||||
|
private ContentService contentService;
|
||||||
|
|
||||||
|
/** The search service. */
|
||||||
|
private SearchService searchService;
|
||||||
|
|
||||||
|
/** The namespace service. */
|
||||||
|
private NamespaceService namespaceService;
|
||||||
|
|
||||||
|
/** The system bootstrap. */
|
||||||
|
private ImporterBootstrap systemBootstrap;
|
||||||
|
|
||||||
|
/** The transaction service. */
|
||||||
|
private TransactionService transactionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the name.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* the new name
|
||||||
|
*/
|
||||||
|
public void setName(final String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the node service.
|
||||||
|
*
|
||||||
|
* @param nodeService
|
||||||
|
* the new node service
|
||||||
|
*/
|
||||||
|
public void setNodeService(final NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.nodeService = nodeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the content service.
|
||||||
|
*
|
||||||
|
* @param contentService
|
||||||
|
* the new content service
|
||||||
|
*/
|
||||||
|
public void setContentService(final ContentService contentService)
|
||||||
|
{
|
||||||
|
this.contentService = contentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the search service.
|
||||||
|
*
|
||||||
|
* @param searchService
|
||||||
|
* the new search service
|
||||||
|
*/
|
||||||
|
public void setSearchService(final SearchService searchService)
|
||||||
|
{
|
||||||
|
this.searchService = searchService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the namespace service.
|
||||||
|
*
|
||||||
|
* @param namespaceService
|
||||||
|
* the new namespace service
|
||||||
|
*/
|
||||||
|
public void setNamespaceService(final NamespaceService namespaceService)
|
||||||
|
{
|
||||||
|
this.namespaceService = namespaceService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the system bootstrap.
|
||||||
|
*
|
||||||
|
* @param systemBootstrap
|
||||||
|
* the new system bootstrap
|
||||||
|
*/
|
||||||
|
public void setSystemBootstrap(final ImporterBootstrap systemBootstrap)
|
||||||
|
{
|
||||||
|
this.systemBootstrap = systemBootstrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the transaction service.
|
||||||
|
*
|
||||||
|
* @param transactionService
|
||||||
|
* the new transaction service
|
||||||
|
*/
|
||||||
|
public void setTransactionService(final TransactionService transactionService)
|
||||||
|
{
|
||||||
|
this.transactionService = transactionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.descriptor.DescriptorPersistence#getDescriptor()
|
||||||
|
*/
|
||||||
|
public Descriptor getDescriptor()
|
||||||
|
{
|
||||||
|
// retrieve system descriptor
|
||||||
|
final NodeRef descriptorNodeRef = getDescriptorNodeRef(false);
|
||||||
|
|
||||||
|
// create appropriate descriptor
|
||||||
|
if (descriptorNodeRef != null)
|
||||||
|
{
|
||||||
|
final Map<QName, Serializable> properties = this.nodeService.getProperties(descriptorNodeRef);
|
||||||
|
return new RepositoryDescriptor(properties);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see
|
||||||
|
* org.alfresco.repo.descriptor.DescriptorPersistence#updateDescriptor(org.alfresco.service.descriptor.Descriptor)
|
||||||
|
*/
|
||||||
|
public Descriptor updateDescriptor(final Descriptor serverDescriptor)
|
||||||
|
{
|
||||||
|
final NodeRef currentDescriptorNodeRef = getDescriptorNodeRef(true);
|
||||||
|
// if the node is missing but it should have been created
|
||||||
|
if (currentDescriptorNodeRef == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// set the properties
|
||||||
|
if (!this.transactionService.isReadOnly())
|
||||||
|
{
|
||||||
|
this.nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_NAME, serverDescriptor
|
||||||
|
.getName());
|
||||||
|
this.nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_MAJOR,
|
||||||
|
serverDescriptor.getVersionMajor());
|
||||||
|
this.nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_MINOR,
|
||||||
|
serverDescriptor.getVersionMinor());
|
||||||
|
this.nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_REVISION,
|
||||||
|
serverDescriptor.getVersionRevision());
|
||||||
|
this.nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_LABEL,
|
||||||
|
serverDescriptor.getVersionLabel());
|
||||||
|
this.nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_BUILD,
|
||||||
|
serverDescriptor.getVersionBuild());
|
||||||
|
this.nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_SCHEMA,
|
||||||
|
serverDescriptor.getSchema());
|
||||||
|
|
||||||
|
// The version edition property may already have been overwritten with a license, so only set the property
|
||||||
|
// if it doesn't already contain ContentData
|
||||||
|
final Serializable value = this.nodeService.getProperty(currentDescriptorNodeRef,
|
||||||
|
ContentModel.PROP_SYS_VERSION_EDITION);
|
||||||
|
if (!(value instanceof Collection) || ((Collection<?>) value).isEmpty()
|
||||||
|
|| ((Collection<?>) value).iterator().next() instanceof String)
|
||||||
|
{
|
||||||
|
final Collection<String> editions = new ArrayList<String>();
|
||||||
|
editions.add(serverDescriptor.getEdition());
|
||||||
|
this.nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_EDITION,
|
||||||
|
(Serializable) editions);
|
||||||
|
}
|
||||||
|
|
||||||
|
// done
|
||||||
|
if (RepositoryDescriptorDAOImpl.logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
RepositoryDescriptorDAOImpl.logger.debug("Updated current repository descriptor properties: \n"
|
||||||
|
+ " node: " + currentDescriptorNodeRef + "\n" + " descriptor: " + serverDescriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Map<QName, Serializable> properties = this.nodeService.getProperties(currentDescriptorNodeRef);
|
||||||
|
return new RepositoryDescriptor(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.descriptor.DescriptorPersistence#getLicenseKey()
|
||||||
|
*/
|
||||||
|
public byte[] getLicenseKey()
|
||||||
|
{
|
||||||
|
byte[] key = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final NodeRef descriptorRef = getDescriptorNodeRef(true);
|
||||||
|
if (descriptorRef == null)
|
||||||
|
{
|
||||||
|
throw new LicenseException("Failed to find system descriptor");
|
||||||
|
}
|
||||||
|
final ContentReader reader = this.contentService.getReader(descriptorRef,
|
||||||
|
ContentModel.PROP_SYS_VERSION_EDITION);
|
||||||
|
if (reader != null && reader.exists())
|
||||||
|
{
|
||||||
|
final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
|
reader.getContent(os);
|
||||||
|
key = os.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (final Exception e)
|
||||||
|
{
|
||||||
|
throw new LicenseException("Failed to load license", e);
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.descriptor.DescriptorPersistence#updateLicenseKey(byte[])
|
||||||
|
*/
|
||||||
|
public void updateLicenseKey(final byte[] key)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final NodeRef descriptorRef = getDescriptorNodeRef(true);
|
||||||
|
if (descriptorRef == null)
|
||||||
|
{
|
||||||
|
throw new LicenseException("Failed to find system descriptor");
|
||||||
|
}
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
this.nodeService.setProperty(descriptorRef, ContentModel.PROP_SYS_VERSION_EDITION, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final ContentWriter writer = this.contentService.getWriter(descriptorRef,
|
||||||
|
ContentModel.PROP_SYS_VERSION_EDITION, true);
|
||||||
|
final InputStream is = new ByteArrayInputStream(key);
|
||||||
|
writer.setMimetype(MimetypeMap.MIMETYPE_BINARY);
|
||||||
|
writer.putContent(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (final Exception e)
|
||||||
|
{
|
||||||
|
throw new LicenseException("Failed to save license", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the descriptor node ref.
|
||||||
|
*
|
||||||
|
* @param create
|
||||||
|
* the create
|
||||||
|
* @return the descriptor node ref
|
||||||
|
*/
|
||||||
|
private NodeRef getDescriptorNodeRef(final boolean create)
|
||||||
|
{
|
||||||
|
// retrieve system descriptor location
|
||||||
|
StoreRef storeRef = this.systemBootstrap.getStoreRef();
|
||||||
|
final Properties systemProperties = this.systemBootstrap.getConfiguration();
|
||||||
|
final String path = systemProperties.getProperty(this.name);
|
||||||
|
|
||||||
|
NodeRef descriptorNodeRef = null;
|
||||||
|
final String searchPath = "/" + path;
|
||||||
|
|
||||||
|
// check for the store
|
||||||
|
if (this.nodeService.exists(storeRef))
|
||||||
|
{
|
||||||
|
final NodeRef rootNodeRef = this.nodeService.getRootNode(storeRef);
|
||||||
|
final List<NodeRef> nodeRefs = this.searchService.selectNodes(rootNodeRef, searchPath, null,
|
||||||
|
this.namespaceService, false);
|
||||||
|
if (nodeRefs.size() == 1)
|
||||||
|
{
|
||||||
|
descriptorNodeRef = nodeRefs.get(0);
|
||||||
|
}
|
||||||
|
else if (nodeRefs.size() == 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else if (nodeRefs.size() > 1)
|
||||||
|
{
|
||||||
|
if (RepositoryDescriptorDAOImpl.logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
RepositoryDescriptorDAOImpl.logger.debug("Multiple descriptors: \n" + " store: " + storeRef
|
||||||
|
+ "\n" + " path: " + searchPath);
|
||||||
|
}
|
||||||
|
// get the first one
|
||||||
|
descriptorNodeRef = nodeRefs.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (descriptorNodeRef == null)
|
||||||
|
{
|
||||||
|
if (RepositoryDescriptorDAOImpl.logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
RepositoryDescriptorDAOImpl.logger.debug("Descriptor not found: \n" + " store: " + storeRef + "\n"
|
||||||
|
+ " path: " + searchPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create if necessary
|
||||||
|
if (create)
|
||||||
|
{
|
||||||
|
storeRef = this.nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
|
||||||
|
final NodeRef rootNodeRef = this.nodeService.getRootNode(storeRef);
|
||||||
|
descriptorNodeRef = this.nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN,
|
||||||
|
QName.createQName(path, this.namespaceService),
|
||||||
|
QName.createQName("sys:descriptor", this.namespaceService)).getChildRef();
|
||||||
|
if (RepositoryDescriptorDAOImpl.logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
RepositoryDescriptorDAOImpl.logger.debug("Created missing descriptor node: " + descriptorNodeRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return descriptorNodeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repository Descriptor whose meta-data is retrieved from the repository store.
|
||||||
|
*/
|
||||||
|
private class RepositoryDescriptor extends BaseDescriptor
|
||||||
|
{
|
||||||
|
|
||||||
|
/** The properties. */
|
||||||
|
private final Map<QName, Serializable> properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param properties
|
||||||
|
* system descriptor properties
|
||||||
|
*/
|
||||||
|
private RepositoryDescriptor(final Map<QName, Serializable> properties)
|
||||||
|
{
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getId()
|
||||||
|
*/
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return getDescriptor("sys:node-uuid");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getName()
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return getDescriptor("sys:name");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionMajor()
|
||||||
|
*/
|
||||||
|
public String getVersionMajor()
|
||||||
|
{
|
||||||
|
return getDescriptor("sys:versionMajor");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionMinor()
|
||||||
|
*/
|
||||||
|
public String getVersionMinor()
|
||||||
|
{
|
||||||
|
return getDescriptor("sys:versionMinor");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionRevision()
|
||||||
|
*/
|
||||||
|
public String getVersionRevision()
|
||||||
|
{
|
||||||
|
return getDescriptor("sys:versionRevision");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionLabel()
|
||||||
|
*/
|
||||||
|
public String getVersionLabel()
|
||||||
|
{
|
||||||
|
return getDescriptor("sys:versionLabel");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionBuild()
|
||||||
|
*/
|
||||||
|
public String getVersionBuild()
|
||||||
|
{
|
||||||
|
return getDescriptor("sys:versionBuild");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getEdition()
|
||||||
|
*/
|
||||||
|
public String getEdition()
|
||||||
|
{
|
||||||
|
return getDescriptor("sys:versionEdition");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getSchema()
|
||||||
|
*/
|
||||||
|
public int getSchema()
|
||||||
|
{
|
||||||
|
return getSchema(getDescriptor("sys:versionSchema"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getDescriptorKeys()
|
||||||
|
*/
|
||||||
|
public String[] getDescriptorKeys()
|
||||||
|
{
|
||||||
|
final String[] keys = new String[this.properties.size()];
|
||||||
|
this.properties.keySet().toArray(keys);
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getDescriptor(java.lang.String)
|
||||||
|
*/
|
||||||
|
public String getDescriptor(final String key)
|
||||||
|
{
|
||||||
|
String strValue = null;
|
||||||
|
final QName qname = QName.createQName(key, RepositoryDescriptorDAOImpl.this.namespaceService);
|
||||||
|
final Serializable value = this.properties.get(qname);
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
if (value instanceof Collection)
|
||||||
|
{
|
||||||
|
final Collection<?> coll = (Collection<?>) value;
|
||||||
|
if (coll.size() > 0)
|
||||||
|
{
|
||||||
|
strValue = coll.iterator().next().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strValue = value.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return strValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,218 @@
|
|||||||
|
/*
|
||||||
|
* 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 received 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.descriptor;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.alfresco.repo.descriptor.DescriptorServiceImpl.BaseDescriptor;
|
||||||
|
import org.alfresco.service.descriptor.Descriptor;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages retrieval of the server Descriptor from a read-only resource file.
|
||||||
|
*/
|
||||||
|
public class ServerDescriptorDAOImpl implements DescriptorDAO
|
||||||
|
{
|
||||||
|
|
||||||
|
/** The repository name. */
|
||||||
|
private String repositoryName;
|
||||||
|
|
||||||
|
/** The server properties. */
|
||||||
|
protected Properties serverProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the repository properties from a resource file.
|
||||||
|
*
|
||||||
|
* @param repositoryName
|
||||||
|
* the repository name
|
||||||
|
* @throws IOException
|
||||||
|
* Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
|
public void setRepositoryName(final String repositoryName) throws IOException
|
||||||
|
{
|
||||||
|
this.repositoryName = repositoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the server descriptor from a resource file.
|
||||||
|
*
|
||||||
|
* @param descriptorResource
|
||||||
|
* resource containing server descriptor meta-data
|
||||||
|
* @throws IOException
|
||||||
|
* Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
|
public void setResource(final Resource descriptorResource) throws IOException
|
||||||
|
{
|
||||||
|
this.serverProperties = new Properties();
|
||||||
|
this.serverProperties.load(descriptorResource.getInputStream());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.DescriptorPersistence#getDescriptor()
|
||||||
|
*/
|
||||||
|
public Descriptor getDescriptor()
|
||||||
|
{
|
||||||
|
return new ServerDescriptor();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.DescriptorPersistence#getLicenseKey()
|
||||||
|
*/
|
||||||
|
public byte[] getLicenseKey()
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see
|
||||||
|
* org.alfresco.service.descriptor.DescriptorPersistence#updateDescriptor(org.alfresco.service.descriptor.Descriptor
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public Descriptor updateDescriptor(final Descriptor serverDescriptor)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.DescriptorPersistence#updateLicenseKey(byte[])
|
||||||
|
*/
|
||||||
|
public void updateLicenseKey(final byte[] key)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server Descriptor whose meta-data is retrieved from run-time environment.
|
||||||
|
*/
|
||||||
|
private class ServerDescriptor extends BaseDescriptor
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getId()
|
||||||
|
*/
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return "<Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getName()
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return ServerDescriptorDAOImpl.this.repositoryName == null ? "<Unknown>"
|
||||||
|
: ServerDescriptorDAOImpl.this.repositoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionMajor()
|
||||||
|
*/
|
||||||
|
public String getVersionMajor()
|
||||||
|
{
|
||||||
|
return ServerDescriptorDAOImpl.this.serverProperties.getProperty("version.major");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionMinor()
|
||||||
|
*/
|
||||||
|
public String getVersionMinor()
|
||||||
|
{
|
||||||
|
return ServerDescriptorDAOImpl.this.serverProperties.getProperty("version.minor");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionRevision()
|
||||||
|
*/
|
||||||
|
public String getVersionRevision()
|
||||||
|
{
|
||||||
|
return ServerDescriptorDAOImpl.this.serverProperties.getProperty("version.revision");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionLabel()
|
||||||
|
*/
|
||||||
|
public String getVersionLabel()
|
||||||
|
{
|
||||||
|
return ServerDescriptorDAOImpl.this.serverProperties.getProperty("version.label");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionBuild()
|
||||||
|
*/
|
||||||
|
public String getVersionBuild()
|
||||||
|
{
|
||||||
|
return ServerDescriptorDAOImpl.this.serverProperties.getProperty("version.build");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getEdition()
|
||||||
|
*/
|
||||||
|
public String getEdition()
|
||||||
|
{
|
||||||
|
return ServerDescriptorDAOImpl.this.serverProperties.getProperty("version.edition");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getSchema()
|
||||||
|
*/
|
||||||
|
public int getSchema()
|
||||||
|
{
|
||||||
|
return getSchema(ServerDescriptorDAOImpl.this.serverProperties.getProperty("version.schema"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getDescriptorKeys()
|
||||||
|
*/
|
||||||
|
public String[] getDescriptorKeys()
|
||||||
|
{
|
||||||
|
final String[] keys = new String[ServerDescriptorDAOImpl.this.serverProperties.size()];
|
||||||
|
ServerDescriptorDAOImpl.this.serverProperties.keySet().toArray(keys);
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getDescriptor(java.lang.String)
|
||||||
|
*/
|
||||||
|
public String getDescriptor(final String key)
|
||||||
|
{
|
||||||
|
return ServerDescriptorDAOImpl.this.serverProperties.getProperty(key, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -15,6 +15,6 @@ public class AlfrescoOracle10gDialect extends Oracle10gDialect
|
|||||||
public AlfrescoOracle10gDialect()
|
public AlfrescoOracle10gDialect()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
registerColumnType( Types.VARCHAR, "blob" );
|
registerColumnType( Types.VARBINARY, "blob" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,6 @@ public class AlfrescoOracle9iDialect extends Oracle9iDialect
|
|||||||
public AlfrescoOracle9iDialect()
|
public AlfrescoOracle9iDialect()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
registerColumnType( Types.VARCHAR, "blob" );
|
registerColumnType( Types.VARBINARY, "blob" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -47,6 +48,9 @@ public class BehaviourFilterImpl implements BehaviourFilter
|
|||||||
// Dictionary Service
|
// Dictionary Service
|
||||||
private DictionaryService dictionaryService;
|
private DictionaryService dictionaryService;
|
||||||
|
|
||||||
|
// Tenant Service
|
||||||
|
private TenantService tenantService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dictionaryService dictionary service
|
* @param dictionaryService dictionary service
|
||||||
*/
|
*/
|
||||||
@@ -55,6 +59,14 @@ public class BehaviourFilterImpl implements BehaviourFilter
|
|||||||
this.dictionaryService = dictionaryService;
|
this.dictionaryService = dictionaryService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param tenantService dictionary service
|
||||||
|
*/
|
||||||
|
public void setTenantService(TenantService tenantService)
|
||||||
|
{
|
||||||
|
this.tenantService = tenantService;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.policy.BehaviourFilter#disableBehaviour(org.alfresco.service.namespace.QName)
|
* @see org.alfresco.repo.policy.BehaviourFilter#disableBehaviour(org.alfresco.service.namespace.QName)
|
||||||
*/
|
*/
|
||||||
@@ -79,6 +91,8 @@ public class BehaviourFilterImpl implements BehaviourFilter
|
|||||||
*/
|
*/
|
||||||
public boolean disableBehaviour(NodeRef nodeRef, QName className)
|
public boolean disableBehaviour(NodeRef nodeRef, QName className)
|
||||||
{
|
{
|
||||||
|
nodeRef = tenantService.getName(nodeRef);
|
||||||
|
|
||||||
Map<NodeRef,List<QName>> filters = nodeRefFilter.get();
|
Map<NodeRef,List<QName>> filters = nodeRefFilter.get();
|
||||||
if (filters == null)
|
if (filters == null)
|
||||||
{
|
{
|
||||||
@@ -116,6 +130,8 @@ public class BehaviourFilterImpl implements BehaviourFilter
|
|||||||
*/
|
*/
|
||||||
public void enableBehaviour(NodeRef nodeRef, QName className)
|
public void enableBehaviour(NodeRef nodeRef, QName className)
|
||||||
{
|
{
|
||||||
|
nodeRef = tenantService.getName(nodeRef);
|
||||||
|
|
||||||
Map<NodeRef,List<QName>> filters = nodeRefFilter.get();
|
Map<NodeRef,List<QName>> filters = nodeRefFilter.get();
|
||||||
if (filters != null)
|
if (filters != null)
|
||||||
{
|
{
|
||||||
@@ -136,6 +152,8 @@ public class BehaviourFilterImpl implements BehaviourFilter
|
|||||||
*/
|
*/
|
||||||
public void enableBehaviours(NodeRef nodeRef)
|
public void enableBehaviours(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
|
nodeRef = tenantService.getName(nodeRef);
|
||||||
|
|
||||||
Map<NodeRef,List<QName>> filters = nodeRefFilter.get();
|
Map<NodeRef,List<QName>> filters = nodeRefFilter.get();
|
||||||
if (filters != null)
|
if (filters != null)
|
||||||
{
|
{
|
||||||
@@ -166,6 +184,8 @@ public class BehaviourFilterImpl implements BehaviourFilter
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodeRef = tenantService.getName(nodeRef);
|
||||||
|
|
||||||
// check node level filters
|
// check node level filters
|
||||||
Map<NodeRef,List<QName>> nodeFilters = nodeRefFilter.get();
|
Map<NodeRef,List<QName>> nodeFilters = nodeRefFilter.get();
|
||||||
if (nodeFilters != null)
|
if (nodeFilters != null)
|
||||||
|
@@ -324,8 +324,7 @@ public class MultiTNodeServiceInterceptor extends DelegatingIntroductionIntercep
|
|||||||
else if (rawValue instanceof ChildAssociationRef)
|
else if (rawValue instanceof ChildAssociationRef)
|
||||||
{
|
{
|
||||||
ChildAssociationRef ref = (ChildAssociationRef) rawValue;
|
ChildAssociationRef ref = (ChildAssociationRef) rawValue;
|
||||||
// TODO use getBaseName ... fix tenant bootstrap
|
value = tenantService.getBaseName(ref);
|
||||||
value = tenantService.getName(ref);
|
|
||||||
}
|
}
|
||||||
else if (rawValue instanceof AssociationRef)
|
else if (rawValue instanceof AssociationRef)
|
||||||
{
|
{
|
||||||
|
@@ -34,19 +34,20 @@ import org.springframework.beans.BeansException;
|
|||||||
import org.springframework.beans.factory.BeanFactory;
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
import org.springframework.beans.factory.BeanFactoryAware;
|
import org.springframework.beans.factory.BeanFactoryAware;
|
||||||
import org.springframework.beans.factory.BeanNameAware;
|
import org.springframework.beans.factory.BeanNameAware;
|
||||||
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
import org.springframework.beans.factory.FactoryBean;
|
import org.springframework.beans.factory.FactoryBean;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springmodules.workflow.jbpm31.JbpmFactoryLocator;
|
import org.springmodules.workflow.jbpm31.JbpmFactoryLocator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of Spring Module's JbpmConfigurationFactoryBean for
|
* Implementation of Spring Module's JbpmConfigurationFactoryBean for Jbpm 3.2.
|
||||||
* Jbpm 3.2.
|
|
||||||
*
|
*
|
||||||
* @author Costin Leau
|
* @author Costin Leau
|
||||||
* @author davidc
|
* @author davidc
|
||||||
*/
|
*/
|
||||||
public class AlfrescoJbpmConfigurationFactoryBean implements InitializingBean, FactoryBean, BeanFactoryAware, BeanNameAware
|
public class AlfrescoJbpmConfigurationFactoryBean implements InitializingBean, FactoryBean, BeanFactoryAware,
|
||||||
|
BeanNameAware, DisposableBean
|
||||||
{
|
{
|
||||||
private JbpmConfiguration jbpmConfiguration;
|
private JbpmConfiguration jbpmConfiguration;
|
||||||
private ObjectFactory objectFactory;
|
private ObjectFactory objectFactory;
|
||||||
@@ -57,61 +58,69 @@ public class AlfrescoJbpmConfigurationFactoryBean implements InitializingBean, F
|
|||||||
/**
|
/**
|
||||||
* FactoryLocator
|
* FactoryLocator
|
||||||
*/
|
*/
|
||||||
private JbpmFactoryLocator factoryLocator = new JbpmFactoryLocator();
|
private final AlfrescoJbpmFactoryLocator factoryLocator = new AlfrescoJbpmFactoryLocator();
|
||||||
|
|
||||||
|
/*
|
||||||
/* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
|
* @see
|
||||||
|
* org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
|
||||||
*/
|
*/
|
||||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
|
public void setBeanFactory(final BeanFactory beanFactory) throws BeansException
|
||||||
{
|
{
|
||||||
factoryLocator.setBeanFactory(beanFactory);
|
this.factoryLocator.setBeanFactory(beanFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
|
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public void setBeanName(String name)
|
public void setBeanName(final String name)
|
||||||
{
|
{
|
||||||
factoryLocator.setBeanName(name);
|
this.factoryLocator.setBeanName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||||
*/
|
*/
|
||||||
public void afterPropertiesSet() throws Exception
|
public void afterPropertiesSet() throws Exception
|
||||||
{
|
{
|
||||||
if (configuration == null)
|
if (this.configuration == null)
|
||||||
|
{
|
||||||
throw new IllegalArgumentException("configuration or objectFactory property need to be not null");
|
throw new IllegalArgumentException("configuration or objectFactory property need to be not null");
|
||||||
|
}
|
||||||
|
|
||||||
// 1. Construct Jbpm Configuration
|
// 1. Construct Jbpm Configuration
|
||||||
// NOTE: Jbpm 3.2 adds a JbpmConfiguration value to its context
|
// NOTE: Jbpm 3.2 adds a JbpmConfiguration value to its context
|
||||||
InputStream stream = configuration.getInputStream();
|
final InputStream stream = this.configuration.getInputStream();
|
||||||
jbpmConfiguration = JbpmConfiguration.parseInputStream(stream);
|
this.jbpmConfiguration = JbpmConfiguration.parseInputStream(stream);
|
||||||
|
|
||||||
// 2. inject the HB session factory if it is the case
|
// 2. inject the HB session factory if it is the case
|
||||||
if (sessionFactory != null)
|
if (this.sessionFactory != null)
|
||||||
{
|
{
|
||||||
JbpmContext context = jbpmConfiguration.createJbpmContext(contextName);
|
final JbpmContext context = this.jbpmConfiguration.createJbpmContext(this.contextName);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
context.setSessionFactory(sessionFactory);
|
context.setSessionFactory(this.sessionFactory);
|
||||||
} finally
|
}
|
||||||
|
finally
|
||||||
{
|
{
|
||||||
context.close();
|
context.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
* @see org.springframework.beans.factory.FactoryBean#getObject()
|
* @see org.springframework.beans.factory.FactoryBean#getObject()
|
||||||
*/
|
*/
|
||||||
public Object getObject() throws Exception
|
public Object getObject() throws Exception
|
||||||
{
|
{
|
||||||
return jbpmConfiguration;
|
return this.jbpmConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
* @see org.springframework.beans.factory.FactoryBean#getObjectType()
|
* @see org.springframework.beans.factory.FactoryBean#getObjectType()
|
||||||
*/
|
*/
|
||||||
public Class getObjectType()
|
public Class getObjectType()
|
||||||
@@ -119,7 +128,8 @@ public class AlfrescoJbpmConfigurationFactoryBean implements InitializingBean, F
|
|||||||
return JbpmConfiguration.class;
|
return JbpmConfiguration.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
* @see org.springframework.beans.factory.FactoryBean#isSingleton()
|
* @see org.springframework.beans.factory.FactoryBean#isSingleton()
|
||||||
*/
|
*/
|
||||||
public boolean isSingleton()
|
public boolean isSingleton()
|
||||||
@@ -132,13 +142,14 @@ public class AlfrescoJbpmConfigurationFactoryBean implements InitializingBean, F
|
|||||||
*/
|
*/
|
||||||
public Resource getConfiguration()
|
public Resource getConfiguration()
|
||||||
{
|
{
|
||||||
return configuration;
|
return this.configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param configuration The configuration to set
|
* @param configuration
|
||||||
|
* The configuration to set
|
||||||
*/
|
*/
|
||||||
public void setConfiguration(Resource configuration)
|
public void setConfiguration(final Resource configuration)
|
||||||
{
|
{
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
}
|
}
|
||||||
@@ -148,13 +159,14 @@ public class AlfrescoJbpmConfigurationFactoryBean implements InitializingBean, F
|
|||||||
*/
|
*/
|
||||||
public ObjectFactory getObjectFactory()
|
public ObjectFactory getObjectFactory()
|
||||||
{
|
{
|
||||||
return objectFactory;
|
return this.objectFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param objectFactory The objectFactory to set
|
* @param objectFactory
|
||||||
|
* The objectFactory to set
|
||||||
*/
|
*/
|
||||||
public void setObjectFactory(ObjectFactory objectFactory)
|
public void setObjectFactory(final ObjectFactory objectFactory)
|
||||||
{
|
{
|
||||||
this.objectFactory = objectFactory;
|
this.objectFactory = objectFactory;
|
||||||
}
|
}
|
||||||
@@ -164,13 +176,14 @@ public class AlfrescoJbpmConfigurationFactoryBean implements InitializingBean, F
|
|||||||
*/
|
*/
|
||||||
public String getContextName()
|
public String getContextName()
|
||||||
{
|
{
|
||||||
return contextName;
|
return this.contextName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param contextName The contextName to set
|
* @param contextName
|
||||||
|
* The contextName to set
|
||||||
*/
|
*/
|
||||||
public void setContextName(String contextName)
|
public void setContextName(final String contextName)
|
||||||
{
|
{
|
||||||
this.contextName = contextName;
|
this.contextName = contextName;
|
||||||
}
|
}
|
||||||
@@ -180,15 +193,37 @@ public class AlfrescoJbpmConfigurationFactoryBean implements InitializingBean, F
|
|||||||
*/
|
*/
|
||||||
public SessionFactory getSessionFactory()
|
public SessionFactory getSessionFactory()
|
||||||
{
|
{
|
||||||
return sessionFactory;
|
return this.sessionFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sessionFactory The sessionFactory to set
|
* @param sessionFactory
|
||||||
|
* The sessionFactory to set
|
||||||
*/
|
*/
|
||||||
public void setSessionFactory(SessionFactory sessionFactory)
|
public void setSessionFactory(final SessionFactory sessionFactory)
|
||||||
{
|
{
|
||||||
this.sessionFactory = sessionFactory;
|
this.sessionFactory = sessionFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.springframework.beans.factory.DisposableBean#destroy()
|
||||||
|
*/
|
||||||
|
public void destroy() throws Exception
|
||||||
|
{
|
||||||
|
this.factoryLocator.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class AlfrescoJbpmFactoryLocator extends JbpmFactoryLocator
|
||||||
|
{
|
||||||
|
public void destroy()
|
||||||
|
{
|
||||||
|
JbpmFactoryLocator.beanFactories.clear();
|
||||||
|
JbpmFactoryLocator.beanFactoriesNames.clear();
|
||||||
|
JbpmFactoryLocator.referenceCounter.clear();
|
||||||
|
JbpmFactoryLocator.canUseDefaultBeanFactory = true;
|
||||||
|
JbpmFactoryLocator.defaultFactory = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -71,5 +71,4 @@ public interface DescriptorService
|
|||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
public LicenseDescriptor getLicenseDescriptor();
|
public LicenseDescriptor getLicenseDescriptor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
* As a special exception to the terms and conditions of version 2.0 of
|
* 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
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
* FLOSS exception. You should have recieved a copy of the text describing
|
* FLOSS exception. You should have received a copy of the text describing
|
||||||
* the FLOSS exception, and it is also available here:
|
* the FLOSS exception, and it is also available here:
|
||||||
* http://www.alfresco.com/legal/licensing"
|
* http://www.alfresco.com/legal/licensing"
|
||||||
*/
|
*/
|
||||||
@@ -27,9 +27,8 @@ package org.alfresco.service.license;
|
|||||||
import org.alfresco.service.NotAuditable;
|
import org.alfresco.service.NotAuditable;
|
||||||
import org.alfresco.service.PublicService;
|
import org.alfresco.service.PublicService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contract for managing licenses
|
* Contract for managing licenses.
|
||||||
*
|
*
|
||||||
* @author davidc
|
* @author davidc
|
||||||
*/
|
*/
|
||||||
@@ -38,24 +37,33 @@ public interface LicenseService
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify License
|
* Begin the license verification loop. Throws an exception if a new .lic file has been supplied that is invalid.
|
||||||
|
* Will quietly make the repository read only if there is no license and the repository isn't eligible for the free
|
||||||
|
* trial period or the license has expired.
|
||||||
*
|
*
|
||||||
* @throws LicenseException
|
* @throws LicenseException
|
||||||
|
* if an invalid .lic file has been supplied
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
public void verifyLicense() throws LicenseException;
|
public void verifyLicense() throws LicenseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get description of installed license
|
* Was the license known to be valid the last time it was checked?.
|
||||||
*
|
*
|
||||||
* @return license descriptor (or null, if one is not installed)
|
* @return true if there is a valid license
|
||||||
* @throws LicenseException
|
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
public boolean isLicenseValid();
|
||||||
public LicenseDescriptor getLicense() throws LicenseException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs the service it is being shutdown
|
* Get description of installed license.
|
||||||
|
*
|
||||||
|
* @return license descriptor (or null, if no valid license is installed)
|
||||||
|
*/
|
||||||
|
@NotAuditable
|
||||||
|
public LicenseDescriptor getLicense();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informs the service it is being shutdown.
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
public void shutdown();
|
public void shutdown();
|
||||||
|
Reference in New Issue
Block a user