svn merge -r 2570:2595 svn://www.alfresco.org/alfresco/BRANCHES/V1.2.0/root HEAD/root

svn merge -r 2597:2649 svn://www.alfresco.org/alfresco/BRANCHES/V1.2.0/root HEAD/root


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2650 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-04-12 14:58:21 +00:00
parent c3adde8ac4
commit 776314da72
17 changed files with 469 additions and 63 deletions

View File

@@ -20,7 +20,6 @@ import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -239,33 +238,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
}
}
/**
* Create current repository descriptor
*
* @return descriptor
*/
private Descriptor createCurrentRepositoryDescriptor()
{
// retrieve system descriptor location
StoreRef storeRef = systemBootstrap.getStoreRef();
Properties systemProperties = systemBootstrap.getConfiguration();
String path = systemProperties.getProperty("system.descriptor.current.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.
*
@@ -286,13 +258,12 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
return;
}
// set the properties
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(17);
properties.put(ContentModel.PROP_SYS_VERSION_MAJOR, serverDescriptor.getVersionMajor());
properties.put(ContentModel.PROP_SYS_VERSION_MINOR, serverDescriptor.getVersionMinor());
properties.put(ContentModel.PROP_SYS_VERSION_REVISION, serverDescriptor.getVersionRevision());
properties.put(ContentModel.PROP_SYS_VERSION_LABEL, serverDescriptor.getVersionLabel());
properties.put(ContentModel.PROP_SYS_VERSION_SCHEMA, serverDescriptor.getSchema());
nodeService.setProperties(currentDescriptorNodeRef, properties);
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_SCHEMA, serverDescriptor.getSchema());
// done
if (logger.isDebugEnabled())
{
@@ -377,8 +348,8 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
// NOTE: We could tie in the License Component via Spring configuration, but then it could
// be declaratively taken out in an installed environment.
Class licenseComponentClass = Class.forName("org.alfresco.license.LicenseComponent");
Constructor constructor = licenseComponentClass.getConstructor(new Class[] { ApplicationContext.class, Descriptor.class} );
licenseService = (LicenseService)constructor.newInstance(new Object[] { applicationContext, createCurrentRepositoryDescriptor() } );
Constructor constructor = licenseComponentClass.getConstructor(new Class[] { ApplicationContext.class} );
licenseService = (LicenseService)constructor.newInstance(new Object[] { applicationContext });
}
catch (ClassNotFoundException e)
{
@@ -415,13 +386,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
private class NOOPLicenseService implements LicenseService
{
/* (non-Javadoc)
* @see org.alfresco.service.license.LicenseService#install()
*/
public void installLicense() throws LicenseException
{
}
/* (non-Javadoc)
* @see org.alfresco.service.license.LicenseService#verify()
*/

View File

@@ -16,6 +16,7 @@
*/
package org.alfresco.repo.descriptor;
import java.security.Principal;
import java.util.Date;
import java.util.Map;
@@ -88,6 +89,11 @@ public class DescriptorStartupLog implements ApplicationListener
{
String subject = license.getSubject();
String msg = "Alfresco license: " + subject;
String holder = getHolderOrganisation(license.getHolder());
if (holder != null)
{
msg += " granted to " + holder;
}
Date validUntil = license.getValidUntil();
if (validUntil != null)
{
@@ -100,6 +106,8 @@ public class DescriptorStartupLog implements ApplicationListener
{
msg += " (does not expire)";
}
logger.info(msg);
}
@@ -119,4 +127,34 @@ public class DescriptorStartupLog implements ApplicationListener
}
}
/**
* Get Organisation from Principal
*
* @param holderPrincipal
* @return organisation
*/
private String getHolderOrganisation(Principal holderPrincipal)
{
String holder = null;
if (holderPrincipal != null)
{
holder = holderPrincipal.getName();
if (holder != null)
{
String[] properties = holder.split(",");
for (String property : properties)
{
String[] parts = property.split("=");
if (parts[0].equals("O"))
{
holder = parts[1];
}
}
}
}
return holder;
}
}