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

@@ -13,6 +13,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: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>
</sys:descriptor> </sys:descriptor>

View File

@@ -617,9 +617,170 @@
<!-- Query collections should be loaded on demand using this component - once loaded thay are available for use --> <!-- Query collections should be loaded on demand using this component - once loaded thay are available for use -->
</bean> </bean>
<!-- Security related beans --> <!-- Importers -->
<bean id="viewParser" class="org.alfresco.repo.importer.view.ViewParser">
<property name="namespaceService">
<ref bean="namespaceService" />
</property>
<property name="dictionaryService">
<ref bean="dictionaryService" />
</property>
</bean>
<bean id="importerComponent" class="org.alfresco.repo.importer.ImporterComponent">
<!-- For now, hard-wire the view parser -->
<property name="namespaceService">
<ref bean="NamespaceService" />
</property>
<property name="dictionaryService">
<ref bean="DictionaryService" />
</property>
<property name="nodeService">
<ref bean="NodeService" />
</property>
<property name="searchService">
<ref bean="SearchService" />
</property>
<property name="contentService">
<ref bean="ContentService" />
</property>
<property name="ruleService">
<ref bean="RuleService" />
</property>
<property name="permissionService">
<ref bean="PermissionService" />
</property>
<property name="authorityService">
<ref bean="AuthorityService" />
</property>
<property name="authenticationService">
<ref bean="AuthenticationService" />
</property>
<property name="viewParser">
<ref bean="viewParser" />
</property>
<property name="behaviourFilter">
<ref bean="policyBehaviourFilter" />
</property>
<property name="ownableService">
<ref bean="ownableService" />
</property>
</bean>
<bean id="storeImporter" class="org.alfresco.repo.importer.ImporterBootstrap" abstract="true">
<property name="transactionService">
<ref bean="transactionComponent"/>
</property>
<property name="nodeService">
<ref bean="nodeService"/>
</property>
<property name="importerService">
<ref bean="importerComponent"/>
</property>
<property name="namespaceService">
<ref bean="namespaceService"/>
</property>
<property name="authenticationComponent">
<ref bean="authenticationComponent" />
</property>
<property name="allowWrite">
<value>${server.transaction.allow-writes}</value>
</property>
<!-- To specify a locale other than the system default, uncomment the following
<property name="locale">
<value>en_GB</value>
</property>
-->
</bean>
<bean id="userStoreImporter" parent="storeImporter" abstract="true">
<property name="storeUrl">
<value>${alfresco_user_store.store}</value>
</property>
<property name="configuration">
<props>
<prop key="alfresco_user_store.system_container.childname">${alfresco_user_store.system_container.childname}</prop>
<prop key="alfresco_user_store.user_container.childname">${alfresco_user_store.user_container.childname}</prop>
<prop key="alfresco_user_store.authorities_container.childname">${alfresco_user_store.authorities_container.childname}</prop>
</props>
</property>
</bean>
<bean id="systemStoreImporter" parent="storeImporter" abstract="true">
<property name="storeUrl">
<value>${system.store}</value>
</property>
<property name="mustNotExistStoreUrls">
<list>
<value>${spaces.store}</value>
</list>
</property>
<property name="configuration">
<props>
<prop key="version.major">${version.major}</prop>
<prop key="version.minor">${version.minor}</prop>
<prop key="version.revision">${version.revision}</prop>
<prop key="version.label">${version.label}</prop>
<prop key="version.schema">${version.schema}</prop>
<prop key="version.edition">${version.edition}</prop>
<prop key="system.descriptor.childname">${system.descriptor.childname}</prop>
<prop key="system.descriptor.current.childname">${system.descriptor.current.childname}</prop>
</props>
</property>
</bean>
<bean id="spacesStoreImporter" parent="storeImporter" abstract="true">
<property name="storeUrl">
<value>${spaces.store}</value>
</property>
<property name="configuration">
<props>
<prop key="spaces.company_home.childname">${spaces.company_home.childname}</prop>
<prop key="spaces.guest_home.childname">${spaces.guest_home.childname}</prop>
<prop key="system.system_container.childname">${system.system_container.childname}</prop>
<prop key="system.people_container.childname">${system.people_container.childname}</prop>
<prop key="spaces.dictionary.childname">${spaces.dictionary.childname}</prop>
<prop key="spaces.templates.childname">${spaces.templates.childname}</prop>
<prop key="spaces.templates.content.childname">${spaces.templates.content.childname}</prop>
<prop key="spaces.savedsearches.childname">${spaces.savedsearches.childname}</prop>
</props>
</property>
</bean>
<bean id="versionStoreImporter" parent="storeImporter" abstract="true">
<property name="storeUrl">
<value>workspace://lightWeightVersionStore</value>
</property>
</bean>
<!-- Exporters -->
<bean id="exporterComponent" class="org.alfresco.repo.exporter.ExporterComponent">
<property name="namespaceService">
<ref bean="NamespaceService" />
</property>
<property name="dictionaryService">
<ref bean="DictionaryService" />
</property>
<property name="nodeService">
<ref bean="NodeService" />
</property>
<property name="searchService">
<ref bean="SearchService" />
</property>
<property name="contentService">
<ref bean="ContentService" />
</property>
<property name="descriptorService">
<ref bean="DescriptorService" />
</property>
<property name="authenticationService">
<ref bean="AuthenticationService" />
</property>
<property name="permissionService">
<ref bean="PermissionService" />
</property>
</bean>
<!-- Audit --> <!-- Audit -->
<bean id="auditableAspect" class="org.alfresco.repo.audit.AuditableAspect" init-method="init"> <bean id="auditableAspect" class="org.alfresco.repo.audit.AuditableAspect" init-method="init">

View File

@@ -60,3 +60,6 @@ patch.emailTemplatesFolder.result.created=The email templates folder was success
patch.emailTemplatesContent.description=Loads the email templates into the Email Templates folder. patch.emailTemplatesContent.description=Loads the email templates into the Email Templates folder.
patch.emailTemplatesContent.result=Imported the Email Templates into the default folder. patch.emailTemplatesContent.result=Imported the Email Templates into the default folder.
patch.descriptorUpdate.description=Update Repository descriptor
patch.descriptorUpdate.result=Repository descriptor updated

View File

@@ -46,9 +46,10 @@
<mandatory enforced="true">true</mandatory> <mandatory enforced="true">true</mandatory>
<default>0</default> <default>0</default>
</property> </property>
<property name="sys:license"> <property name="sys:versionEdition">
<type>d:content</type> <type>d:any</type>
</property> <multiple>true</multiple>
</property>
</properties> </properties>
</type> </type>

View File

@@ -320,4 +320,19 @@
<!-- Note: targetSchema 11 is allocated for patching in an enterprise trial license --> <!-- 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) --> <!-- A patch bean is not provided as this is handled by the license component internally (enterprise only) -->
<bean id="patch.descriptorUpdate" class="org.alfresco.repo.admin.patch.impl.DescriptorUpdatePatch" parent="basePatch" >
<property name="id"><value>patch.descriptorUpdate</value></property>
<property name="description"><value>patch.descriptorUpdate.description</value></property>
<property name="fixesFromSchema"><value>0</value></property>
<property name="fixesToSchema"><value>11</value></property>
<property name="targetSchema"><value>12</value></property>
<!-- helper beans for execution -->
<property name="systemBootstrap">
<ref bean="systemBootstrap"/>
</property>
<property name="searchService">
<ref bean="searchService"/>
</property>
</bean>
</beans> </beans>

View File

@@ -7,7 +7,7 @@
version.major=1 version.major=1
version.minor=3 version.minor=3
version.revision=0 version.revision=0
version.label=dev version.label=
# Edition label # Edition label
@@ -15,4 +15,4 @@ version.edition=Community Network
# Schema number # Schema number
version.schema=11 version.schema=12

View File

@@ -58,7 +58,8 @@ public interface ContentModel
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_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_LICENSE = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "license"); static final QName PROP_SYS_VERSION_EDITION = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionEdition");
// //

View File

@@ -277,7 +277,7 @@ public abstract class AbstractPatch implements Patch
{ {
if (value == null) if (value == null)
{ {
throw new PatchException(ERR_PROPERTY_NOT_SET, "bootstrapView", this); throw new PatchException(ERR_PROPERTY_NOT_SET, name, this);
} }
} }

View File

@@ -0,0 +1,86 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.repo.admin.patch.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.admin.patch.AbstractPatch;
import org.alfresco.repo.importer.ImporterBootstrap;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
/**
* Apply Version Edition to Repository Descriptor
*
* @author David Caruana
*/
public class DescriptorUpdatePatch extends AbstractPatch
{
private static final String MSG_SUCCESS = "patch.descriptorUpdate.result";
private ImporterBootstrap systemBootstrap;
public void setSystemBootstrap(ImporterBootstrap systemBootstrap)
{
this.systemBootstrap = systemBootstrap;
}
@Override
protected String applyInternal() throws Exception
{
checkPropertyNotNull(systemBootstrap, "systemBootstrap");
// retrieve system descriptor location
StoreRef storeRef = systemBootstrap.getStoreRef();
Properties systemProperties = systemBootstrap.getConfiguration();
// check for the store
if (nodeService.exists(storeRef))
{
// get the current descriptor
String path = systemProperties.getProperty("system.descriptor.current.childname");
String searchPath = "/" + path;
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
List<NodeRef> nodeRefs = searchService.selectNodes(rootNodeRef, searchPath, null, namespaceService, false);
if (nodeRefs.size() > 0)
{
NodeRef descriptorNodeRef = nodeRefs.get(0);
// set version edition
Serializable value = nodeService.getProperty(descriptorNodeRef, ContentModel.PROP_SYS_VERSION_EDITION);
if (value == null)
{
String edition = systemProperties.getProperty("version.edition");
Collection<String> editions = new ArrayList<String>();
editions.add(edition);
nodeService.setProperty(descriptorNodeRef, ContentModel.PROP_SYS_VERSION_EDITION, (Serializable)editions);
}
}
}
// done
String msg = I18NUtil.getMessage(MSG_SUCCESS);
return msg;
}
}

View File

@@ -18,6 +18,7 @@ package org.alfresco.repo.coci;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
@@ -27,6 +28,7 @@ import org.alfresco.repo.transaction.TransactionUtil;
import org.alfresco.repo.version.VersionModel; import org.alfresco.repo.version.VersionModel;
import org.alfresco.service.cmr.coci.CheckOutCheckInService; import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.lock.LockService; import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
@@ -282,6 +284,32 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
this.cociService.checkin(workingCopy2, new HashMap<String, Serializable>(), null, true); this.cociService.checkin(workingCopy2, new HashMap<String, Serializable>(), null, true);
} }
public void testCheckOutCheckInWithTranslatableAspect()
{
// Create a node to be used as the translation
NodeRef translationNodeRef = this.nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}translation"),
ContentModel.TYPE_CONTENT).getChildRef();
this.nodeService.addAspect(this.nodeRef, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "translatable"), null);
this.nodeService.createAssociation(this.nodeRef, translationNodeRef, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "translations"));
// Check it out
NodeRef workingCopy = this.cociService.checkout(
this.nodeRef,
this.rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}workingCopy"));
// Check it back in again
Map<String, Serializable> versionProperties = new HashMap<String, Serializable>();
versionProperties.put(Version.PROP_DESCRIPTION, "This is a test version");
this.cociService.checkin(workingCopy, versionProperties);
}
/** /**
* Test when the aspect is not set when check-in is performed * Test when the aspect is not set when check-in is performed
*/ */
@@ -399,8 +427,8 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
}); });
//NodeRef wk3 = this.cociService.getWorkingCopy(this.nodeRef); NodeRef wk3 = this.cociService.getWorkingCopy(this.nodeRef);
//assertNull(wk3); assertNull(wk3);
} }
} }

View File

@@ -240,9 +240,7 @@ public class RoutingContentService implements ContentService
private ContentReader getReader(NodeRef nodeRef, QName propertyQName, boolean fireContentReadPolicy) private ContentReader getReader(NodeRef nodeRef, QName propertyQName, boolean fireContentReadPolicy)
{ {
// get the property value
ContentData contentData = null; ContentData contentData = null;
Serializable propValue = nodeService.getProperty(nodeRef, propertyQName); Serializable propValue = nodeService.getProperty(nodeRef, propertyQName);
if (propValue instanceof Collection) if (propValue instanceof Collection)
{ {
@@ -252,6 +250,7 @@ public class RoutingContentService implements ContentService
propValue = (Serializable)colPropValue.iterator().next(); propValue = (Serializable)colPropValue.iterator().next();
} }
} }
if (propValue instanceof ContentData) if (propValue instanceof ContentData)
{ {
contentData = (ContentData)propValue; contentData = (ContentData)propValue;
@@ -272,7 +271,7 @@ public class RoutingContentService implements ContentService
propertyQName); propertyQName);
} }
} }
// check that the URL is available // check that the URL is available
if (contentData == null || contentData.getContentUrl() == null) if (contentData == null || contentData.getContentUrl() == null)
{ {
@@ -315,9 +314,10 @@ public class RoutingContentService implements ContentService
ContentWriter writer = store.getWriter(existingContentReader, null); ContentWriter writer = store.getWriter(existingContentReader, null);
// set extra data on the reader if the property is pre-existing // set extra data on the reader if the property is pre-existing
ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, propertyQName); Serializable contentValue = nodeService.getProperty(nodeRef, propertyQName);
if (contentData != null) if (contentValue != null && contentValue instanceof ContentData)
{ {
ContentData contentData = (ContentData)contentValue;
writer.setMimetype(contentData.getMimetype()); writer.setMimetype(contentData.getMimetype());
writer.setEncoding(contentData.getEncoding()); writer.setEncoding(contentData.getEncoding());
} }

View File

@@ -607,9 +607,23 @@ public class CopyServiceImpl implements CopyService
{ {
for (AssociationRef assocRef : nodeAssocRefs) for (AssociationRef assocRef : nodeAssocRefs)
{ {
// Add the association
NodeRef targetRef = assocRef.getTargetRef(); NodeRef targetRef = assocRef.getTargetRef();
this.nodeService.createAssociation(destinationNodeRef, targetRef, assocRef.getTypeQName());
boolean exists = false;
for (AssociationRef assocRef2 : this.nodeService.getTargetAssocs(destinationNodeRef, assocRef.getTypeQName()))
{
if (targetRef.equals(assocRef2.getTargetRef()) == true)
{
exists = true;
break;
}
}
if (exists == false)
{
// Add the association
this.nodeService.createAssociation(destinationNodeRef, targetRef, assocRef.getTypeQName());
}
} }
} }
} }

View File

@@ -20,7 +20,6 @@ import java.io.IOException;
import java.io.Serializable; 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.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; 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. * Push the current server descriptor properties into persistence.
* *
@@ -286,13 +258,12 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
return; return;
} }
// set the properties // set the properties
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(17); nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_MAJOR, serverDescriptor.getVersionMajor());
properties.put(ContentModel.PROP_SYS_VERSION_MAJOR, serverDescriptor.getVersionMajor()); nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_MINOR, serverDescriptor.getVersionMinor());
properties.put(ContentModel.PROP_SYS_VERSION_MINOR, serverDescriptor.getVersionMinor()); nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_REVISION, serverDescriptor.getVersionRevision());
properties.put(ContentModel.PROP_SYS_VERSION_REVISION, serverDescriptor.getVersionRevision()); nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_LABEL, serverDescriptor.getVersionLabel());
properties.put(ContentModel.PROP_SYS_VERSION_LABEL, serverDescriptor.getVersionLabel()); nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_SCHEMA, serverDescriptor.getSchema());
properties.put(ContentModel.PROP_SYS_VERSION_SCHEMA, serverDescriptor.getSchema());
nodeService.setProperties(currentDescriptorNodeRef, properties);
// done // done
if (logger.isDebugEnabled()) 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 // 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, Descriptor.class} ); Constructor constructor = licenseComponentClass.getConstructor(new Class[] { ApplicationContext.class} );
licenseService = (LicenseService)constructor.newInstance(new Object[] { applicationContext, createCurrentRepositoryDescriptor() } ); licenseService = (LicenseService)constructor.newInstance(new Object[] { applicationContext });
} }
catch (ClassNotFoundException e) catch (ClassNotFoundException e)
{ {
@@ -415,13 +386,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/ */
private class NOOPLicenseService implements LicenseService private class NOOPLicenseService implements LicenseService
{ {
/* (non-Javadoc)
* @see org.alfresco.service.license.LicenseService#install()
*/
public void installLicense() throws LicenseException
{
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.service.license.LicenseService#verify() * @see org.alfresco.service.license.LicenseService#verify()
*/ */

View File

@@ -16,6 +16,7 @@
*/ */
package org.alfresco.repo.descriptor; package org.alfresco.repo.descriptor;
import java.security.Principal;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@@ -88,6 +89,11 @@ public class DescriptorStartupLog implements ApplicationListener
{ {
String subject = license.getSubject(); String subject = license.getSubject();
String msg = "Alfresco license: " + subject; String msg = "Alfresco license: " + subject;
String holder = getHolderOrganisation(license.getHolder());
if (holder != null)
{
msg += " granted to " + holder;
}
Date validUntil = license.getValidUntil(); Date validUntil = license.getValidUntil();
if (validUntil != null) if (validUntil != null)
{ {
@@ -100,6 +106,8 @@ public class DescriptorStartupLog implements ApplicationListener
{ {
msg += " (does not expire)"; msg += " (does not expire)";
} }
logger.info(msg); 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;
}
} }

View File

@@ -22,6 +22,8 @@ import java.util.List;
import org.alfresco.i18n.I18NUtil; import org.alfresco.i18n.I18NUtil;
import org.alfresco.service.cmr.dictionary.DictionaryException; import org.alfresco.service.cmr.dictionary.DictionaryException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
@@ -40,6 +42,10 @@ public class DictionaryBootstrap
// Dictionary DAO // Dictionary DAO
private DictionaryDAO dictionaryDAO = null; private DictionaryDAO dictionaryDAO = null;
// Logger
private static Log logger = LogFactory.getLog(DictionaryDAO.class);
/** /**
* Sets the Dictionary DAO * Sets the Dictionary DAO
@@ -86,6 +92,9 @@ public class DictionaryBootstrap
} }
try try
{ {
if (logger.isInfoEnabled())
logger.info("Loading model from " + bootstrapModel);
M2Model model = M2Model.createModel(modelStream); M2Model model = M2Model.createModel(modelStream);
dictionaryDAO.putModel(model); dictionaryDAO.putModel(model);
} }

View File

@@ -31,6 +31,8 @@ import org.alfresco.service.cmr.dictionary.ModelDefinition;
import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
@@ -56,6 +58,9 @@ public class DictionaryDAOImpl implements DictionaryDAO
// Map of model name to compiled model // Map of model name to compiled model
private Map<QName,CompiledModel> compiledModels = new HashMap<QName,CompiledModel>(); private Map<QName,CompiledModel> compiledModels = new HashMap<QName,CompiledModel>();
// Logger
private static Log logger = LogFactory.getLog(DictionaryDAO.class);
/** /**
* Construct * Construct
@@ -99,6 +104,15 @@ public class DictionaryDAOImpl implements DictionaryDAO
// Publish new Model Definition // Publish new Model Definition
compiledModels.put(modelName, compiledModel); compiledModels.put(modelName, compiledModel);
if (logger.isInfoEnabled())
{
logger.info("Registered model " + modelName.toPrefixString(namespaceDAO));
for (M2Namespace namespace : model.getNamespaces())
{
logger.info("Registered namespace '" + namespace.getUri() + "' (prefix '" + namespace.getPrefix() + "')");
}
}
} }
/** /**

View File

@@ -26,13 +26,16 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.security.AccessPermission; import org.alfresco.service.cmr.security.AccessPermission;
import org.alfresco.service.cmr.view.ImportPackageHandler; import org.alfresco.service.cmr.view.ImportPackageHandler;
import org.alfresco.service.cmr.view.ImporterBinding;
import org.alfresco.service.cmr.view.ImporterException; import org.alfresco.service.cmr.view.ImporterException;
import org.alfresco.service.cmr.view.ImporterProgress; import org.alfresco.service.cmr.view.ImporterProgress;
import org.alfresco.service.cmr.view.ImporterService; import org.alfresco.service.cmr.view.ImporterService;
import org.alfresco.service.cmr.view.Location; import org.alfresco.service.cmr.view.Location;
import org.alfresco.service.cmr.view.ImporterBinding.UUID_BINDING;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
/** /**
* Import Tool. * Import Tool.
* *
@@ -126,6 +129,18 @@ public class Import extends Tool
} }
context.encoding = args[i]; context.encoding = args[i];
} }
else if (args[i].equals("-uuidBinding"))
{
i++;
try
{
context.uuidBinding = UUID_BINDING.valueOf(UUID_BINDING.class, args[i]);
}
catch(IllegalArgumentException e)
{
throw new ToolException("The value " + args[i] + " is an invalid uuidBinding");
}
}
else if (args[i].equals("-quiet")) else if (args[i].equals("-quiet"))
{ {
context.setQuiet(true); context.setQuiet(true);
@@ -168,6 +183,7 @@ public class Import extends Tool
System.out.println(" -d[ir] the source directory to import from (default: current directory)"); System.out.println(" -d[ir] the source directory to import from (default: current directory)");
System.out.println(" -pwd password for login"); System.out.println(" -pwd password for login");
System.out.println(" -encoding package file encoding (default: " + Charset.defaultCharset() + ")"); System.out.println(" -encoding package file encoding (default: " + Charset.defaultCharset() + ")");
System.out.println(" -uuidBinding CREATE_NEW, REMOVE_EXISTING, REPLACE_EXISTING, UPDATE_EXISTING, THROW_ON_COLLISION (default: CREATE_NEW)");
System.out.println(" -quiet do not display any messages during import"); System.out.println(" -quiet do not display any messages during import");
System.out.println(" -verbose report import progress"); System.out.println(" -verbose report import progress");
} }
@@ -202,7 +218,8 @@ public class Import extends Tool
try try
{ {
importer.importView(importHandler, context.getLocation(), null, new ImportProgress()); ImportBinding binding = new ImportBinding(context.uuidBinding);
importer.importView(importHandler, context.getLocation(), binding, new ImportProgress());
} }
catch(ImporterException e) catch(ImporterException e)
{ {
@@ -360,6 +377,8 @@ public class Import extends Tool
private String packageName; private String packageName;
/** The package encoding */ /** The package encoding */
private String encoding = null; private String encoding = null;
/** The UUID Binding */
private UUID_BINDING uuidBinding = UUID_BINDING.CREATE_NEW;
/** Zip Package? */ /** Zip Package? */
private boolean zipFile = false; private boolean zipFile = false;
@@ -451,5 +470,57 @@ public class Import extends Tool
return (zipFile) ? new File(packageName) : getDataFile(); return (zipFile) ? new File(packageName) : getDataFile();
} }
} }
/**
* Import Tool Binding
*
* @author davidc
*/
private class ImportBinding implements ImporterBinding
{
private UUID_BINDING uuidBinding = null;
/**
* Construct
*
* @param uuidBinding
*/
public ImportBinding(UUID_BINDING uuidBinding)
{
this.uuidBinding = uuidBinding;
}
/*
* (non-Javadoc)
* @see org.alfresco.service.cmr.view.ImporterBinding#getUUIDBinding()
*/
public UUID_BINDING getUUIDBinding()
{
return uuidBinding;
}
/*
* (non-Javadoc)
* @see org.alfresco.service.cmr.view.ImporterBinding#allowReferenceWithinTransaction()
*/
public boolean allowReferenceWithinTransaction()
{
return false;
}
/*
* (non-Javadoc)
* @see org.alfresco.service.cmr.view.ImporterBinding#getValue(java.lang.String)
*/
public String getValue(String key)
{
return null;
}
public QName[] getExcludedClasses()
{
return new QName[] {};
}
}
} }