Merge V1.2.0 BRANCH to HEAD

svn merge -r 2566:2569 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@2570 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley 2006-03-22 16:21:14 +00:00
parent 506e408ca7
commit d4d33c1e34
5 changed files with 82 additions and 32 deletions

View File

@ -359,4 +359,8 @@
</property>
</bean>
<!-- Note: targetSchema 11 is allocated for patching in an enterprise trial license -->
<!-- A patch bean is not provided as this is handled by the license component internally (enterprise only) -->
>>>>>>> .merge-right.r2569
</beans>

View File

@ -15,4 +15,4 @@ version.edition=Community Network
# Schema number
version.schema=10
version.schema=11

View File

@ -160,7 +160,7 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
public LicenseDescriptor getLicenseDescriptor()
{
return licenseService.getLicense();
return (licenseService == null) ? null : licenseService.getLicense();
}
/**
@ -176,6 +176,9 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
{
public Descriptor doWork()
{
// initialise license service (if installed)
initialiseLicenseService();
// verify license, but only if license component is installed
licenseService.verifyLicense();
@ -197,9 +200,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
{
// initialise server descriptor
serverDescriptor = createServerDescriptor();
// initialise license service (if installed)
initialiseLicenseService();
}
/**
@ -239,6 +239,33 @@ 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.
*
@ -284,33 +311,32 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
private NodeRef getDescriptorNodeRef(StoreRef storeRef, String path, boolean create)
{
// check for the store and create if necessary
if (!nodeService.exists(storeRef) && create)
{
storeRef = nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
}
String searchPath = "/" + path;
NodeRef descriptorNodeRef = null;
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
List<NodeRef> nodeRefs = searchService.selectNodes(rootNodeRef, searchPath, null, namespaceService, false);
if (nodeRefs.size() == 1)
String searchPath = "/" + path;
// check for the store
if (nodeService.exists(storeRef))
{
descriptorNodeRef = nodeRefs.get(0);
}
else if (nodeRefs.size() == 0)
{
}
else if (nodeRefs.size() > 1)
{
if (logger.isDebugEnabled())
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
List<NodeRef> nodeRefs = searchService.selectNodes(rootNodeRef, searchPath, null, namespaceService, false);
if (nodeRefs.size() == 1)
{
logger.debug("Multiple descriptors: \n" +
" store: " + storeRef + "\n" +
" path: " + searchPath);
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);
}
// get the first one
descriptorNodeRef = nodeRefs.get(0);
}
if (descriptorNodeRef == null)
@ -321,9 +347,12 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
" 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,
@ -348,8 +377,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} );
licenseService = (LicenseService)constructor.newInstance(new Object[] { applicationContext } );
Constructor constructor = licenseComponentClass.getConstructor(new Class[] { ApplicationContext.class, Descriptor.class} );
licenseService = (LicenseService)constructor.newInstance(new Object[] { applicationContext, createCurrentRepositoryDescriptor() } );
}
catch (ClassNotFoundException e)
{

View File

@ -85,6 +85,10 @@ public class ImporterBootstrap implements ApplicationListener
private Locale locale = null;
private AuthenticationComponent authenticationComponent;
// Bootstrap performed?
private boolean bootstrapPerformed = false;
/**
* Set whether we write or not
*
@ -263,6 +267,16 @@ public class ImporterBootstrap implements ApplicationListener
{
this.logEnabled = logEnabled;
}
/**
* Determine if bootstrap was performed?
*
* @return true => bootstrap was performed
*/
public boolean hasPerformedBootstrap()
{
return bootstrapPerformed;
}
/**
* Boostrap the Repository
@ -394,6 +408,9 @@ public class ImporterBootstrap implements ApplicationListener
}
}
}
// a bootstrap was performed
bootstrapPerformed = !useExistingStore;
}
userTransaction.commit();
}

View File

@ -44,9 +44,9 @@ public interface DescriptorService
public Descriptor getInstalledRepositoryDescriptor();
/**
* Gets the License Service
* Gets the License Descriptor
*
* @return the license service
* @return the license descriptor
*/
public LicenseDescriptor getLicenseDescriptor();