mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
- Incorporated build number into version number messages i.e. at server startup, in about dialog and in database.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3428 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
<sys:versionMajor>${version.major}</sys:versionMajor>
|
<sys:versionMajor>${version.major}</sys:versionMajor>
|
||||||
<sys:versionMinor>${version.minor}</sys:versionMinor>
|
<sys:versionMinor>${version.minor}</sys:versionMinor>
|
||||||
<sys:versionRevision>${version.revision}</sys:versionRevision>
|
<sys:versionRevision>${version.revision}</sys:versionRevision>
|
||||||
|
<sys:versionBuild>${version.build}</sys:versionBuild>
|
||||||
<sys:versionLabel>${version.label}</sys:versionLabel>
|
<sys:versionLabel>${version.label}</sys:versionLabel>
|
||||||
<sys:versionSchema>${version.schema}</sys:versionSchema>
|
<sys:versionSchema>${version.schema}</sys:versionSchema>
|
||||||
</sys:descriptor>
|
</sys:descriptor>
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
<sys:versionMajor>${version.major}</sys:versionMajor>
|
<sys:versionMajor>${version.major}</sys:versionMajor>
|
||||||
<sys:versionMinor>${version.minor}</sys:versionMinor>
|
<sys:versionMinor>${version.minor}</sys:versionMinor>
|
||||||
<sys:versionRevision>${version.revision}</sys:versionRevision>
|
<sys:versionRevision>${version.revision}</sys:versionRevision>
|
||||||
|
<sys:versionBuild>${version.build}</sys:versionBuild>
|
||||||
<sys:versionEdition><view:values><view:value>${version.edition}</view:value></view:values></sys:versionEdition>
|
<sys:versionEdition><view:values><view:value>${version.edition}</view:value></view:values></sys:versionEdition>
|
||||||
<sys:versionLabel>${version.label}</sys:versionLabel>
|
<sys:versionLabel>${version.label}</sys:versionLabel>
|
||||||
<sys:versionSchema>${version.schema}</sys:versionSchema>
|
<sys:versionSchema>${version.schema}</sys:versionSchema>
|
||||||
|
@@ -218,6 +218,7 @@
|
|||||||
<prop key="version.major">${version.major}</prop>
|
<prop key="version.major">${version.major}</prop>
|
||||||
<prop key="version.minor">${version.minor}</prop>
|
<prop key="version.minor">${version.minor}</prop>
|
||||||
<prop key="version.revision">${version.revision}</prop>
|
<prop key="version.revision">${version.revision}</prop>
|
||||||
|
<prop key="version.build">${version.build}</prop>
|
||||||
<prop key="version.label">${version.label}</prop>
|
<prop key="version.label">${version.label}</prop>
|
||||||
<prop key="version.schema">${version.schema}</prop>
|
<prop key="version.schema">${version.schema}</prop>
|
||||||
<prop key="version.edition">${version.edition}</prop>
|
<prop key="version.edition">${version.edition}</prop>
|
||||||
|
@@ -41,6 +41,9 @@
|
|||||||
<property name="sys:versionLabel">
|
<property name="sys:versionLabel">
|
||||||
<type>d:text</type>
|
<type>d:text</type>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sys:versionBuild">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
<property name="sys:versionSchema">
|
<property name="sys:versionSchema">
|
||||||
<type>d:int</type>
|
<type>d:int</type>
|
||||||
<mandatory enforced="true">true</mandatory>
|
<mandatory enforced="true">true</mandatory>
|
||||||
|
@@ -73,6 +73,7 @@ public interface ContentModel
|
|||||||
static final QName PROP_SYS_VERSION_MINOR = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionMinor");
|
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");
|
static final QName PROP_SYS_VERSION_REVISION = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionRevision");
|
||||||
static final QName PROP_SYS_VERSION_LABEL = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionLabel");
|
static final QName PROP_SYS_VERSION_LABEL = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionLabel");
|
||||||
|
static final QName PROP_SYS_VERSION_BUILD = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionBuild");
|
||||||
static final QName PROP_SYS_VERSION_SCHEMA = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionSchema");
|
static final QName PROP_SYS_VERSION_SCHEMA = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionSchema");
|
||||||
static final QName PROP_SYS_VERSION_EDITION = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionEdition");
|
static final QName PROP_SYS_VERSION_EDITION = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionEdition");
|
||||||
|
|
||||||
|
@@ -270,6 +270,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_MINOR, serverDescriptor.getVersionMinor());
|
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_REVISION, serverDescriptor.getVersionRevision());
|
||||||
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_LABEL, serverDescriptor.getVersionLabel());
|
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());
|
nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_SCHEMA, serverDescriptor.getSchema());
|
||||||
|
|
||||||
// done
|
// done
|
||||||
@@ -449,6 +450,14 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionBuild()
|
||||||
|
*/
|
||||||
|
public String getVersionBuild()
|
||||||
|
{
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersion()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersion()
|
||||||
*/
|
*/
|
||||||
@@ -491,14 +500,99 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for Descriptor implementations, provides a
|
||||||
|
* default getVersion() implementation.
|
||||||
|
*
|
||||||
|
* @author gavinc
|
||||||
|
*/
|
||||||
|
public abstract class BaseDescriptor implements Descriptor
|
||||||
|
{
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.descriptor.Descriptor#getVersion()
|
||||||
|
*/
|
||||||
|
public String getVersion()
|
||||||
|
{
|
||||||
|
StringBuilder version = new StringBuilder(getVersionMajor());
|
||||||
|
version.append(".");
|
||||||
|
version.append(getVersionMinor());
|
||||||
|
version.append(".");
|
||||||
|
version.append(getVersionRevision());
|
||||||
|
|
||||||
|
String label = getVersionLabel();
|
||||||
|
String build = getVersionBuild();
|
||||||
|
|
||||||
|
boolean hasLabel = (label != null && label.length() > 0);
|
||||||
|
boolean hasBuild = (build != null && build.length() > 0);
|
||||||
|
|
||||||
|
// add opening bracket if either a label or build number is present
|
||||||
|
if (hasLabel || hasBuild)
|
||||||
|
{
|
||||||
|
version.append(" (");
|
||||||
|
}
|
||||||
|
|
||||||
|
// add label if present
|
||||||
|
if (hasLabel)
|
||||||
|
{
|
||||||
|
version.append(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add build number is present
|
||||||
|
if (hasBuild)
|
||||||
|
{
|
||||||
|
// if there is also a label we need a separating space
|
||||||
|
if (hasLabel)
|
||||||
|
{
|
||||||
|
version.append(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
version.append(build);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add closing bracket if either a label or build number is present
|
||||||
|
if (hasLabel || hasBuild)
|
||||||
|
{
|
||||||
|
version.append(")");
|
||||||
|
}
|
||||||
|
|
||||||
|
return version.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the int representation of the given schema string
|
||||||
|
*
|
||||||
|
* @param schemaStr The schema number as a string
|
||||||
|
* @return The schema number as an int
|
||||||
|
*/
|
||||||
|
protected int getSchema(String schemaStr)
|
||||||
|
{
|
||||||
|
if (schemaStr == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int schema = Integer.parseInt(schemaStr);
|
||||||
|
if (schema < 0)
|
||||||
|
{
|
||||||
|
throw new NumberFormatException();
|
||||||
|
}
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Schema must be a positive integer '" + schemaStr + "' is not!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repository Descriptor whose meta-data is retrieved from the repository store
|
* Repository Descriptor whose meta-data is retrieved from the repository store
|
||||||
*/
|
*/
|
||||||
private class RepositoryDescriptor implements Descriptor
|
private class RepositoryDescriptor extends BaseDescriptor
|
||||||
{
|
{
|
||||||
private Map<QName, Serializable> properties;
|
private Map<QName, Serializable> properties;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct
|
* Construct
|
||||||
*
|
*
|
||||||
@@ -542,17 +636,11 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersion()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionBuild()
|
||||||
*/
|
*/
|
||||||
public String getVersion()
|
public String getVersionBuild()
|
||||||
{
|
{
|
||||||
String version = getVersionMajor() + "." + getVersionMinor() + "." + getVersionRevision();
|
return getDescriptor("sys:versionBuild");
|
||||||
String label = getVersionLabel();
|
|
||||||
if (label != null && label.length() > 0)
|
|
||||||
{
|
|
||||||
version += " (" + label + ")";
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -569,24 +657,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
*/
|
*/
|
||||||
public int getSchema()
|
public int getSchema()
|
||||||
{
|
{
|
||||||
String schemaStr = getDescriptor("sys:versionSchema");
|
return getSchema(getDescriptor("sys:versionSchema"));
|
||||||
if (schemaStr == null)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int schema = Integer.parseInt(schemaStr);
|
|
||||||
if (schema < 0)
|
|
||||||
{
|
|
||||||
throw new NumberFormatException();
|
|
||||||
}
|
|
||||||
return schema;
|
|
||||||
}
|
|
||||||
catch (NumberFormatException e)
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("'version.schema' must be a positive integer");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -618,7 +689,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
/**
|
/**
|
||||||
* Server Descriptor whose meta-data is retrieved from run-time environment
|
* Server Descriptor whose meta-data is retrieved from run-time environment
|
||||||
*/
|
*/
|
||||||
private class ServerDescriptor implements Descriptor
|
private class ServerDescriptor extends BaseDescriptor
|
||||||
{
|
{
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersionMajor()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionMajor()
|
||||||
@@ -653,17 +724,11 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.descriptor.Descriptor#getVersion()
|
* @see org.alfresco.service.descriptor.Descriptor#getVersionBuild()
|
||||||
*/
|
*/
|
||||||
public String getVersion()
|
public String getVersionBuild()
|
||||||
{
|
{
|
||||||
String version = getVersionMajor() + "." + getVersionMinor() + "." + getVersionRevision();
|
return serverProperties.getProperty("version.build");
|
||||||
String label = getVersionLabel();
|
|
||||||
if (label != null && label.length() > 0)
|
|
||||||
{
|
|
||||||
version += " (" + label + ")";
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -680,24 +745,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
|
|||||||
*/
|
*/
|
||||||
public int getSchema()
|
public int getSchema()
|
||||||
{
|
{
|
||||||
String schemaStr = serverProperties.getProperty("version.schema");
|
return getSchema(serverProperties.getProperty("version.schema"));
|
||||||
if (schemaStr == null)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int schema = Integer.parseInt(schemaStr);
|
|
||||||
if (schema < 0)
|
|
||||||
{
|
|
||||||
throw new NumberFormatException();
|
|
||||||
}
|
|
||||||
return schema;
|
|
||||||
}
|
|
||||||
catch (NumberFormatException e)
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("'version.schema' must be a positive integer");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@@ -52,6 +52,13 @@ public interface Descriptor
|
|||||||
*/
|
*/
|
||||||
public String getVersionLabel();
|
public String getVersionLabel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the build number
|
||||||
|
*
|
||||||
|
* @return the build number i.e. build-1
|
||||||
|
*/
|
||||||
|
public String getVersionBuild();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the full version number
|
* Gets the full version number
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user