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">
|
||||
<property name="namespaceService">
|
||||
@@ -642,7 +642,7 @@
|
||||
</property>
|
||||
</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 -->
|
||||
<property name="namespaceService">
|
||||
<ref bean="NamespaceService" />
|
||||
@@ -679,7 +679,7 @@
|
||||
</property>
|
||||
</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">
|
||||
<ref bean="transactionComponent"/>
|
||||
</property>
|
||||
@@ -695,12 +695,33 @@
|
||||
<property name="authenticationComponent">
|
||||
<ref bean="authenticationComponent" />
|
||||
</property>
|
||||
<property name="storeUrl">
|
||||
<value>${system.store}</value>
|
||||
</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>
|
||||
@@ -718,91 +739,10 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="systemBootstrap" parent="systemStoreImporter" depends-on="nodeIndexer, auditableAspect">
|
||||
<!-- 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>
|
||||
<bean id="spacesStoreImporter" parent="storeImporter" abstract="true">
|
||||
<property name="storeUrl">
|
||||
<value>${spaces.store}</value>
|
||||
</property>
|
||||
<property name="allowWrite">
|
||||
<value>${server.transaction.allow-writes}</value>
|
||||
</property>
|
||||
<property name="configuration">
|
||||
<props>
|
||||
<prop key="spaces.company_home.childname">${spaces.company_home.childname}</prop>
|
||||
@@ -817,12 +757,31 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="importerBootstrap" parent="spacesStoreImporter" depends-on="userBootstrap, versionBootstrap">
|
||||
<!-- To specify a locale other than the system default, uncomment the following
|
||||
<property name="locale">
|
||||
<value>en_GB</value>
|
||||
<!-- Bootstrap Files -->
|
||||
|
||||
<bean id="userBootstrap" parent="userStoreImporter">
|
||||
<property name="bootstrapViews">
|
||||
<list>
|
||||
<props>
|
||||
<prop key="path">/</prop>
|
||||
<prop key="location">alfresco/bootstrap/alfrescoUserStore.xml</prop>
|
||||
</props>
|
||||
</list>
|
||||
</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">
|
||||
<list>
|
||||
<props>
|
||||
@@ -856,7 +815,8 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Exporter -->
|
||||
|
||||
<!-- Exporters -->
|
||||
<bean id="exporterComponent" class="org.alfresco.repo.exporter.ExporterComponent">
|
||||
<property name="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.view.ImporterProgress;
|
||||
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 permissionCount = 0;
|
||||
|
||||
private Log logger = LogFactory.getLog(ImportTimerProgress.class);;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
public ImportTimerProgress()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param logger
|
||||
*/
|
||||
public ImportTimerProgress(Log logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.view.ImporterProgress#started()
|
||||
@@ -53,7 +74,9 @@ public class ImportTimerProgress implements ImporterProgress
|
||||
nodeLinkedCount = 0;
|
||||
aspectAdded = 0;
|
||||
permissionCount = 0;
|
||||
System.out.println("Import started at " + start + " (" + start.getTime() + ")");
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Import started at " + start + " (" + start.getTime() + ")");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -61,23 +84,30 @@ public class ImportTimerProgress implements ImporterProgress
|
||||
* @see org.alfresco.service.cmr.view.ImporterProgress#completed()
|
||||
*/
|
||||
public void completed()
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
Date end = new Date();
|
||||
System.out.println("Import completed at " + end + " (" + end.getTime() + ")");
|
||||
logger.debug("Import completed at " + end + " (" + end.getTime() + ")");
|
||||
dumpStats(end);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.view.ImporterProgress#error(java.lang.Throwable)
|
||||
*/
|
||||
public void error(Throwable e)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
Date end = new Date();
|
||||
System.out.println("Error occured at " + end + " (" + end.getTime() + ")");
|
||||
System.out.println("Exception: " + e.toString());
|
||||
logger.debug("Import completed at " + end + " (" + end.getTime() + ")");
|
||||
logger.debug("Error occured at " + end + " (" + end.getTime() + ")");
|
||||
logger.debug("Exception: " + e.toString());
|
||||
dumpStats(end);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
@@ -140,13 +170,16 @@ public class ImportTimerProgress implements ImporterProgress
|
||||
*/
|
||||
private void dumpStats(Date end)
|
||||
{
|
||||
System.out.println("Import duration: " + (end.getTime() - start.getTime()) + " ms (Note: excluding commit time)");
|
||||
System.out.println(" Nodes created: " + nodeCreateCount);
|
||||
System.out.println(" Nodes linked: " + nodeLinkedCount);
|
||||
System.out.println(" Aspects Added: " + aspectAdded);
|
||||
System.out.println(" Properties set: " + propCount);
|
||||
System.out.println(" Content set: " + contentCount);
|
||||
System.out.println(" Permissions set: " + permissionCount);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Import duration: " + (end.getTime() - start.getTime()) + " ms (Note: excluding commit time)");
|
||||
logger.debug(" Nodes created: " + nodeCreateCount);
|
||||
logger.debug(" Nodes linked: " + nodeLinkedCount);
|
||||
logger.debug(" Aspects Added: " + aspectAdded);
|
||||
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.apache.commons.logging.Log;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -62,6 +65,7 @@ public class ImporterBootstrap
|
||||
|
||||
// Logger
|
||||
private static final Log logger = LogFactory.getLog(ImporterBootstrap.class);
|
||||
private boolean logEnabled = false;
|
||||
|
||||
// Dependencies
|
||||
private boolean allowWrite = true;
|
||||
@@ -234,6 +238,16 @@ public class ImporterBootstrap
|
||||
return strLocale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set log
|
||||
*
|
||||
* @param logEnabled
|
||||
*/
|
||||
public void setLog(boolean logEnabled)
|
||||
{
|
||||
this.logEnabled = logEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Boostrap the Repository
|
||||
*/
|
||||
@@ -260,6 +274,14 @@ public class ImporterBootstrap
|
||||
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();
|
||||
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
|
||||
|
||||
@@ -339,7 +361,7 @@ public class ImporterBootstrap
|
||||
ImporterProgress importProgress = null;
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
importProgress = new ImportTimerProgress();
|
||||
importProgress = new ImportTimerProgress(logger);
|
||||
logger.debug("Importing " + view);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user