mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fix for sample user bootstrap extension (6000 user example for Novell) which failed in enterprise build. Change order of bootstrap so that user store is created first. Also added log flag to importerBootstrap allow debug output for bootstrap without first unpacking war file to adjust log4j properties.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2371 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -631,7 +631,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Importer -->
|
<!-- Importers -->
|
||||||
|
|
||||||
<bean id="viewParser" class="org.alfresco.repo.importer.view.ViewParser">
|
<bean id="viewParser" class="org.alfresco.repo.importer.view.ViewParser">
|
||||||
<property name="namespaceService">
|
<property name="namespaceService">
|
||||||
@@ -642,7 +642,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="importerComponent" class="org.alfresco.repo.importer.ImporterComponent">
|
<bean id="importerComponent" class="org.alfresco.repo.importer.ImporterComponent" depends-on="nodeIndexer, auditableAspect">
|
||||||
<!-- For now, hard-wire the view parser -->
|
<!-- For now, hard-wire the view parser -->
|
||||||
<property name="namespaceService">
|
<property name="namespaceService">
|
||||||
<ref bean="NamespaceService" />
|
<ref bean="NamespaceService" />
|
||||||
@@ -679,7 +679,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="systemStoreImporter" class="org.alfresco.repo.importer.ImporterBootstrap" abstract="true" init-method="bootstrap">
|
<bean id="storeImporter" class="org.alfresco.repo.importer.ImporterBootstrap" abstract="true" init-method="bootstrap">
|
||||||
<property name="transactionService">
|
<property name="transactionService">
|
||||||
<ref bean="transactionComponent"/>
|
<ref bean="transactionComponent"/>
|
||||||
</property>
|
</property>
|
||||||
@@ -695,12 +695,33 @@
|
|||||||
<property name="authenticationComponent">
|
<property name="authenticationComponent">
|
||||||
<ref bean="authenticationComponent" />
|
<ref bean="authenticationComponent" />
|
||||||
</property>
|
</property>
|
||||||
<property name="storeUrl">
|
|
||||||
<value>${system.store}</value>
|
|
||||||
</property>
|
|
||||||
<property name="allowWrite">
|
<property name="allowWrite">
|
||||||
<value>${server.transaction.allow-writes}</value>
|
<value>${server.transaction.allow-writes}</value>
|
||||||
</property>
|
</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">
|
<property name="mustNotExistStoreUrls">
|
||||||
<list>
|
<list>
|
||||||
<value>${spaces.store}</value>
|
<value>${spaces.store}</value>
|
||||||
@@ -718,91 +739,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="systemBootstrap" parent="systemStoreImporter" depends-on="nodeIndexer, auditableAspect">
|
<bean id="spacesStoreImporter" parent="storeImporter" abstract="true">
|
||||||
<!-- To specify a locale other than the system default, uncomment the following
|
|
||||||
<property name="locale">
|
|
||||||
<value>en_GB</value>
|
|
||||||
</property>
|
|
||||||
-->
|
|
||||||
<property name="bootstrapViews">
|
|
||||||
<list>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/</prop>
|
|
||||||
<prop key="location">alfresco/bootstrap/descriptor.xml</prop>
|
|
||||||
</props>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="userStoreImporter" class="org.alfresco.repo.importer.ImporterBootstrap" abstract="true" init-method="bootstrap">
|
|
||||||
<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="storeUrl">
|
|
||||||
<value>${alfresco_user_store.store}</value>
|
|
||||||
</property>
|
|
||||||
<property name="allowWrite">
|
|
||||||
<value>${server.transaction.allow-writes}</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="userBootstrap" parent="userStoreImporter" depends-on="systemBootstrap">
|
|
||||||
<!-- To specify a locale other than the system default, uncomment the following
|
|
||||||
<property name="locale">
|
|
||||||
<value>en_GB</value>
|
|
||||||
</property>
|
|
||||||
-->
|
|
||||||
<property name="bootstrapViews">
|
|
||||||
<list>
|
|
||||||
<props>
|
|
||||||
<prop key="path">/</prop>
|
|
||||||
<prop key="location">alfresco/bootstrap/alfrescoUserStore.xml</prop>
|
|
||||||
</props>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="spacesStoreImporter" class="org.alfresco.repo.importer.ImporterBootstrap" abstract="true" init-method="bootstrap">
|
|
||||||
<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="storeUrl">
|
<property name="storeUrl">
|
||||||
<value>${spaces.store}</value>
|
<value>${spaces.store}</value>
|
||||||
</property>
|
</property>
|
||||||
<property name="allowWrite">
|
|
||||||
<value>${server.transaction.allow-writes}</value>
|
|
||||||
</property>
|
|
||||||
<property name="configuration">
|
<property name="configuration">
|
||||||
<props>
|
<props>
|
||||||
<prop key="spaces.company_home.childname">${spaces.company_home.childname}</prop>
|
<prop key="spaces.company_home.childname">${spaces.company_home.childname}</prop>
|
||||||
@@ -817,12 +757,31 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="importerBootstrap" parent="spacesStoreImporter" depends-on="userBootstrap, versionBootstrap">
|
<!-- Bootstrap Files -->
|
||||||
<!-- To specify a locale other than the system default, uncomment the following
|
|
||||||
<property name="locale">
|
<bean id="userBootstrap" parent="userStoreImporter">
|
||||||
<value>en_GB</value>
|
<property name="bootstrapViews">
|
||||||
|
<list>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/alfrescoUserStore.xml</prop>
|
||||||
|
</props>
|
||||||
|
</list>
|
||||||
</property>
|
</property>
|
||||||
-->
|
</bean>
|
||||||
|
|
||||||
|
<bean id="systemBootstrap" parent="systemStoreImporter" depends-on="userBootstrap">
|
||||||
|
<property name="bootstrapViews">
|
||||||
|
<list>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/descriptor.xml</prop>
|
||||||
|
</props>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="importerBootstrap" parent="spacesStoreImporter" depends-on="systemBootstrap, versionBootstrap">
|
||||||
<property name="bootstrapViews">
|
<property name="bootstrapViews">
|
||||||
<list>
|
<list>
|
||||||
<props>
|
<props>
|
||||||
@@ -856,7 +815,8 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Exporter -->
|
|
||||||
|
<!-- Exporters -->
|
||||||
<bean id="exporterComponent" class="org.alfresco.repo.exporter.ExporterComponent">
|
<bean id="exporterComponent" class="org.alfresco.repo.exporter.ExporterComponent">
|
||||||
<property name="namespaceService">
|
<property name="namespaceService">
|
||||||
<ref bean="NamespaceService" />
|
<ref bean="NamespaceService" />
|
||||||
|
@@ -23,6 +23,8 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
import org.alfresco.service.cmr.security.AccessPermission;
|
import org.alfresco.service.cmr.security.AccessPermission;
|
||||||
import org.alfresco.service.cmr.view.ImporterProgress;
|
import org.alfresco.service.cmr.view.ImporterProgress;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +42,25 @@ public class ImportTimerProgress implements ImporterProgress
|
|||||||
private long aspectAdded = 0;
|
private long aspectAdded = 0;
|
||||||
private long permissionCount = 0;
|
private long permissionCount = 0;
|
||||||
|
|
||||||
|
private Log logger = LogFactory.getLog(ImportTimerProgress.class);;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct
|
||||||
|
*/
|
||||||
|
public ImportTimerProgress()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct
|
||||||
|
*
|
||||||
|
* @param logger
|
||||||
|
*/
|
||||||
|
public ImportTimerProgress(Log logger)
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.alfresco.service.cmr.view.ImporterProgress#started()
|
* @see org.alfresco.service.cmr.view.ImporterProgress#started()
|
||||||
@@ -53,7 +74,9 @@ public class ImportTimerProgress implements ImporterProgress
|
|||||||
nodeLinkedCount = 0;
|
nodeLinkedCount = 0;
|
||||||
aspectAdded = 0;
|
aspectAdded = 0;
|
||||||
permissionCount = 0;
|
permissionCount = 0;
|
||||||
System.out.println("Import started at " + start + " (" + start.getTime() + ")");
|
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("Import started at " + start + " (" + start.getTime() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -62,9 +85,12 @@ public class ImportTimerProgress implements ImporterProgress
|
|||||||
*/
|
*/
|
||||||
public void completed()
|
public void completed()
|
||||||
{
|
{
|
||||||
Date end = new Date();
|
if (logger.isDebugEnabled())
|
||||||
System.out.println("Import completed at " + end + " (" + end.getTime() + ")");
|
{
|
||||||
dumpStats(end);
|
Date end = new Date();
|
||||||
|
logger.debug("Import completed at " + end + " (" + end.getTime() + ")");
|
||||||
|
dumpStats(end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -73,10 +99,14 @@ public class ImportTimerProgress implements ImporterProgress
|
|||||||
*/
|
*/
|
||||||
public void error(Throwable e)
|
public void error(Throwable e)
|
||||||
{
|
{
|
||||||
Date end = new Date();
|
if (logger.isDebugEnabled())
|
||||||
System.out.println("Error occured at " + end + " (" + end.getTime() + ")");
|
{
|
||||||
System.out.println("Exception: " + e.toString());
|
Date end = new Date();
|
||||||
dumpStats(end);
|
logger.debug("Import completed at " + end + " (" + end.getTime() + ")");
|
||||||
|
logger.debug("Error occured at " + end + " (" + end.getTime() + ")");
|
||||||
|
logger.debug("Exception: " + e.toString());
|
||||||
|
dumpStats(end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -140,13 +170,16 @@ public class ImportTimerProgress implements ImporterProgress
|
|||||||
*/
|
*/
|
||||||
private void dumpStats(Date end)
|
private void dumpStats(Date end)
|
||||||
{
|
{
|
||||||
System.out.println("Import duration: " + (end.getTime() - start.getTime()) + " ms (Note: excluding commit time)");
|
if (logger.isDebugEnabled())
|
||||||
System.out.println(" Nodes created: " + nodeCreateCount);
|
{
|
||||||
System.out.println(" Nodes linked: " + nodeLinkedCount);
|
logger.debug("Import duration: " + (end.getTime() - start.getTime()) + " ms (Note: excluding commit time)");
|
||||||
System.out.println(" Aspects Added: " + aspectAdded);
|
logger.debug(" Nodes created: " + nodeCreateCount);
|
||||||
System.out.println(" Properties set: " + propCount);
|
logger.debug(" Nodes linked: " + nodeLinkedCount);
|
||||||
System.out.println(" Content set: " + contentCount);
|
logger.debug(" Aspects Added: " + aspectAdded);
|
||||||
System.out.println(" Permissions set: " + permissionCount);
|
logger.debug(" Properties set: " + propCount);
|
||||||
|
logger.debug(" Content set: " + contentCount);
|
||||||
|
logger.debug(" Permissions set: " + permissionCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,9 @@ import org.alfresco.service.namespace.QName;
|
|||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.commons.logging.impl.Log4JLogger;
|
||||||
|
import org.apache.log4j.Level;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,6 +65,7 @@ public class ImporterBootstrap
|
|||||||
|
|
||||||
// Logger
|
// Logger
|
||||||
private static final Log logger = LogFactory.getLog(ImporterBootstrap.class);
|
private static final Log logger = LogFactory.getLog(ImporterBootstrap.class);
|
||||||
|
private boolean logEnabled = false;
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
private boolean allowWrite = true;
|
private boolean allowWrite = true;
|
||||||
@@ -234,6 +238,16 @@ public class ImporterBootstrap
|
|||||||
return strLocale;
|
return strLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set log
|
||||||
|
*
|
||||||
|
* @param logEnabled
|
||||||
|
*/
|
||||||
|
public void setLog(boolean logEnabled)
|
||||||
|
{
|
||||||
|
this.logEnabled = logEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boostrap the Repository
|
* Boostrap the Repository
|
||||||
*/
|
*/
|
||||||
@@ -259,6 +273,14 @@ public class ImporterBootstrap
|
|||||||
{
|
{
|
||||||
throw new ImporterException("Store URL must be provided");
|
throw new ImporterException("Store URL must be provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initialise log level
|
||||||
|
// note: only supported with Log4J
|
||||||
|
if (logEnabled && logger instanceof Log4JLogger)
|
||||||
|
{
|
||||||
|
Logger log4JLogger = ((Log4JLogger)logger).getLogger();
|
||||||
|
log4JLogger.setLevel(Level.DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
UserTransaction userTransaction = transactionService.getUserTransaction();
|
UserTransaction userTransaction = transactionService.getUserTransaction();
|
||||||
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
|
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
|
||||||
@@ -339,7 +361,7 @@ public class ImporterBootstrap
|
|||||||
ImporterProgress importProgress = null;
|
ImporterProgress importProgress = null;
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
importProgress = new ImportTimerProgress();
|
importProgress = new ImportTimerProgress(logger);
|
||||||
logger.debug("Importing " + view);
|
logger.debug("Importing " + view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user