mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge from SEAMIST3
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10718 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -399,6 +399,9 @@
|
||||
<!-- Descriptor Service -->
|
||||
|
||||
<bean id="descriptorComponent" class="org.alfresco.repo.descriptor.DescriptorServiceImpl">
|
||||
<property name="repositoryName">
|
||||
<value>${repository.name}</value>
|
||||
</property>
|
||||
<property name="descriptor">
|
||||
<value>classpath:alfresco/version.properties</value>
|
||||
</property>
|
||||
|
@@ -28,6 +28,10 @@
|
||||
<title>Descriptor</title>
|
||||
<parent>sys:base</parent>
|
||||
<properties>
|
||||
<property name="sys:name">
|
||||
<type>d:text</type>
|
||||
<mandatory enforced="true">true</mandatory>
|
||||
</property>
|
||||
<property name="sys:versionMajor">
|
||||
<type>d:text</type>
|
||||
<mandatory enforced="true">true</mandatory>
|
||||
|
@@ -1,3 +1,7 @@
|
||||
# Repository configuration
|
||||
|
||||
repository.name=Main Repository
|
||||
|
||||
# Directory configuration
|
||||
|
||||
dir.root=./alf_data
|
||||
|
@@ -84,6 +84,7 @@ public interface ContentModel
|
||||
static final QName TYPE_STOREROOT = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "store_root");
|
||||
|
||||
// descriptor properties
|
||||
static final QName PROP_SYS_NAME = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "name");
|
||||
static final QName PROP_SYS_VERSION_MAJOR = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionMajor");
|
||||
static final QName PROP_SYS_VERSION_MINOR = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionMinor");
|
||||
static final QName PROP_SYS_VERSION_REVISION = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionRevision");
|
||||
|
@@ -28,6 +28,8 @@ import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Constructor;
|
||||
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;
|
||||
@@ -66,6 +68,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(DescriptorServiceImpl.class);
|
||||
|
||||
private String repositoryName;
|
||||
private Properties serverProperties;
|
||||
|
||||
private ImporterBootstrap systemBootstrap;
|
||||
@@ -82,8 +85,23 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
|
||||
private Descriptor serverDescriptor;
|
||||
|
||||
private Descriptor currentRepoDescriptor;
|
||||
|
||||
private Descriptor installedRepoDescriptor;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the repository properties from a resource file
|
||||
*
|
||||
* @param repositoryResource resource containing repository properties
|
||||
* @throws IOException
|
||||
*/
|
||||
public void setRepositoryName(String repositoryName)
|
||||
throws IOException
|
||||
{
|
||||
this.repositoryName = repositoryName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the server descriptor from a resource file
|
||||
*
|
||||
@@ -155,6 +173,14 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.service.descriptor.DescriptorService#getCurrentRepositoryDescriptor()
|
||||
*/
|
||||
public Descriptor getCurrentRepositoryDescriptor()
|
||||
{
|
||||
return currentRepoDescriptor;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.descriptor.DescriptorService#getRepositoryDescriptor()
|
||||
*/
|
||||
public Descriptor getInstalledRepositoryDescriptor()
|
||||
@@ -188,9 +214,9 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
licenseService.verifyLicense();
|
||||
|
||||
// persist the server descriptor values
|
||||
updateCurrentRepositoryDescriptor(serverDescriptor);
|
||||
currentRepoDescriptor = updateCurrentRepositoryDescriptor(serverDescriptor);
|
||||
|
||||
// return the repository installed descriptor
|
||||
// create the installed descriptor
|
||||
return createInstalledRepositoryDescriptor();
|
||||
}
|
||||
};
|
||||
@@ -258,7 +284,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
* @param serverDescriptor
|
||||
* the current server descriptor
|
||||
*/
|
||||
private void updateCurrentRepositoryDescriptor(Descriptor serverDescriptor)
|
||||
private Descriptor updateCurrentRepositoryDescriptor(Descriptor serverDescriptor)
|
||||
{
|
||||
// retrieve system descriptor location
|
||||
StoreRef storeRef = systemBootstrap.getStoreRef();
|
||||
@@ -270,18 +296,22 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
// if the node is missing but it should have been created
|
||||
if (currentDescriptorNodeRef == null)
|
||||
{
|
||||
return;
|
||||
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())
|
||||
{
|
||||
@@ -289,6 +319,10 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
}
|
||||
}
|
||||
|
||||
Map<QName, Serializable> properties = nodeService.getProperties(currentDescriptorNodeRef);
|
||||
return new RepositoryDescriptor(properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param storeRef
|
||||
* the store to search
|
||||
@@ -431,6 +465,22 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
/*
|
||||
* (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 "Unknown";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionMajor()
|
||||
*/
|
||||
public String getVersionMajor()
|
||||
@@ -660,6 +710,22 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
/*
|
||||
* (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()
|
||||
@@ -714,7 +780,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
*/
|
||||
public String getEdition()
|
||||
{
|
||||
return null;
|
||||
return getDescriptor("sys:versionEdition");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -750,9 +816,20 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -765,6 +842,22 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
/*
|
||||
* (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()
|
||||
|
@@ -34,6 +34,20 @@ import org.alfresco.util.VersionNumber;
|
||||
*/
|
||||
public interface Descriptor
|
||||
{
|
||||
/**
|
||||
* Gets the id of the item being described
|
||||
*
|
||||
* @return identifier
|
||||
*/
|
||||
public String getId();
|
||||
|
||||
/**
|
||||
* Gets the name of the item being described
|
||||
*
|
||||
* @return name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Gets the major version number, e.g. <u>1</u>.2.3
|
||||
*
|
||||
|
@@ -46,13 +46,22 @@ public interface DescriptorService
|
||||
public Descriptor getServerDescriptor();
|
||||
|
||||
/**
|
||||
* Get descriptor for the repository as it was when first installed. The current
|
||||
* repository descriptor will always be the same as the
|
||||
* Get descriptor for the repository as it is currently installed.
|
||||
*
|
||||
* The current repository descriptor will always be the same as the
|
||||
* {@link #getServerDescriptor() server descriptor}.
|
||||
*
|
||||
* @return repository descriptor
|
||||
*/
|
||||
@NotAuditable
|
||||
public Descriptor getCurrentRepositoryDescriptor();
|
||||
|
||||
/**
|
||||
* Get descriptor for the repository as it was when first installed.
|
||||
*
|
||||
* @return repository descriptor
|
||||
*/
|
||||
@NotAuditable
|
||||
public Descriptor getInstalledRepositoryDescriptor();
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user