mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Tool to run the repository standalone (useful for CIFS and FTP server testing)
Importer no longer flushes integrity events Improvement to one-jar ant script Changed bean local references to normal references in scheduler git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2286 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -135,11 +135,11 @@
|
|||||||
<bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
|
<bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
|
||||||
<property name="triggers">
|
<property name="triggers">
|
||||||
<list>
|
<list>
|
||||||
<ref local="tempFileCleanerTrigger" />
|
<ref bean="tempFileCleanerTrigger" />
|
||||||
<!-- <ref local="fileContentStoreCleanerTrigger"/> -->
|
<!-- <ref local="fileContentStoreCleanerTrigger"/> -->
|
||||||
<ref local="ftsIndexerTrigger" />
|
<ref bean="ftsIndexerTrigger" />
|
||||||
<ref local="indexRecoveryTrigger" />
|
<ref bean="indexRecoveryTrigger" />
|
||||||
<ref local="indexBackupTrigger" />
|
<ref bean="indexBackupTrigger" />
|
||||||
<!--
|
<!--
|
||||||
<ref bean="ldapGroupTrigger" />
|
<ref bean="ldapGroupTrigger" />
|
||||||
<ref bean="ldapPeopleTrigger" />
|
<ref bean="ldapPeopleTrigger" />
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
</javadoc>
|
</javadoc>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="build-single-jar" depends="common.compile-java" >
|
<target name="build-single-jar" depends="common.compile-java" description="Build an self-contained executable jar" >
|
||||||
<property name="dir.one-jar" value="${dir.build}/one-jar" />
|
<property name="dir.one-jar" value="${dir.build}/one-jar" />
|
||||||
<!-- extract the one-jar file -->
|
<!-- extract the one-jar file -->
|
||||||
<unjar src="${dir.common.lib}/one-jar/one-jar-boot-0.95.jar" dest="${dir.one-jar}" overwrite="true" />
|
<unjar src="${dir.common.lib}/one-jar/one-jar-boot-0.95.jar" dest="${dir.one-jar}" overwrite="true" />
|
||||||
@@ -36,10 +36,10 @@
|
|||||||
</fileset>
|
</fileset>
|
||||||
</delete>
|
</delete>
|
||||||
<!-- copy required jars into lib folder -->
|
<!-- copy required jars into lib folder -->
|
||||||
<copy todir="${dir.one-jar}/lib" flatten="true">
|
<copy todir="${dir.one-jar}/lib" flatten="false">
|
||||||
<fileset dir="${dir.common.lib}" includes="**/*.jar" />
|
<fileset dir="${dir.common.lib}" includes="**/*.jar" />
|
||||||
<fileset dir="${dir.project.core}/build/dist" includes="${dir.name.core}.jar" />
|
<fileset dir="${dir.project.core}/build/dist" includes="${dir.name.core}.jar" />
|
||||||
<fileset dir="${dir.project.core}/build" includes="**/*log4j.properties" />
|
<fileset dir="${dir.project.core}/source/java" includes="**/*log4j.properties" />
|
||||||
<fileset dir="${dir.project.repository}/build/dist" includes="${dir.name.repository}.jar" />
|
<fileset dir="${dir.project.repository}/build/dist" includes="${dir.name.repository}.jar" />
|
||||||
</copy>
|
</copy>
|
||||||
<!-- delete target one-jar -->
|
<!-- delete target one-jar -->
|
||||||
|
@@ -31,7 +31,6 @@ import java.util.Set;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.policy.BehaviourFilter;
|
import org.alfresco.repo.policy.BehaviourFilter;
|
||||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
|
||||||
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
|
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
@@ -395,11 +394,6 @@ public class ImporterComponent
|
|||||||
// Import tracking
|
// Import tracking
|
||||||
private List<ImportedNodeRef> nodeRefs = new ArrayList<ImportedNodeRef>();
|
private List<ImportedNodeRef> nodeRefs = new ArrayList<ImportedNodeRef>();
|
||||||
|
|
||||||
// Flush threshold
|
|
||||||
private int flushThreshold = 500;
|
|
||||||
private int flushCount = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct
|
* Construct
|
||||||
*
|
*
|
||||||
@@ -535,14 +529,6 @@ public class ImporterComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// do we need to flush?
|
|
||||||
flushCount++;
|
|
||||||
if (flushCount > flushThreshold)
|
|
||||||
{
|
|
||||||
AlfrescoTransactionSupport.flush();
|
|
||||||
flushCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nodeRef;
|
return nodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
144
source/java/org/alfresco/tools/Repository.java
Normal file
144
source/java/org/alfresco/tools/Repository.java
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* 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.tools;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the full application context and then waits for a
|
||||||
|
* keypress to exit.
|
||||||
|
*
|
||||||
|
* @author Derek Hulley
|
||||||
|
*/
|
||||||
|
public class Repository extends Tool
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
String getToolName()
|
||||||
|
{
|
||||||
|
return "Repository";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
ToolContext processArgs(String[] args) throws ToolException
|
||||||
|
{
|
||||||
|
ToolContext context = new ToolContext();
|
||||||
|
context.setLogin(true);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
while (i < args.length)
|
||||||
|
{
|
||||||
|
if (args[i].equals("-h") || args[i].equals("-help"))
|
||||||
|
{
|
||||||
|
context.setHelp(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (args[i].equals("-user"))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if (i == args.length || args[i].length() == 0)
|
||||||
|
{
|
||||||
|
throw new ToolException("The value <user> for the option -user must be specified");
|
||||||
|
}
|
||||||
|
context.setUsername(args[i]);
|
||||||
|
}
|
||||||
|
else if (args[i].equals("-pwd"))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if (i == args.length || args[i].length() == 0)
|
||||||
|
{
|
||||||
|
throw new ToolException("The value <password> for the option -pwd must be specified");
|
||||||
|
}
|
||||||
|
context.setPassword(args[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ToolException("Unknown option " + args[i] + ". Use -help for options.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// next argument
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void displayHelp()
|
||||||
|
{
|
||||||
|
System.out.println(
|
||||||
|
"usage: repository [OPTIONS] \n" +
|
||||||
|
"\n" +
|
||||||
|
"Initialize the Alfresco application context, initiating any \n" +
|
||||||
|
"configured server beans (e.g. CIFS server, FTP server, etc). \n" +
|
||||||
|
"\n" +
|
||||||
|
"Options: \n" +
|
||||||
|
" -h -help Display this help \n" +
|
||||||
|
" -user USER Login as USER \n" +
|
||||||
|
" -pwd PASSWORD Use PASSWORD to login");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
synchronized void execute() throws ToolException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.out.println("\nRepository initialized.\nPress ENTER to exit...");
|
||||||
|
System.in.read();
|
||||||
|
System.out.println("\nShutting down the repository.");
|
||||||
|
// start the ticker
|
||||||
|
new ShutdownNotifierThread().start();
|
||||||
|
try { wait(3000L); } catch (InterruptedException e) {}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// just ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the repository and wait for a keypress to stop
|
||||||
|
*
|
||||||
|
* @param args not used
|
||||||
|
*/
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
new Repository().start(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ShutdownNotifierThread extends Thread
|
||||||
|
{
|
||||||
|
private ShutdownNotifierThread()
|
||||||
|
{
|
||||||
|
this.setDaemon(true);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public synchronized void run()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
System.out.print('.');
|
||||||
|
try
|
||||||
|
{
|
||||||
|
wait(500L);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -178,7 +178,7 @@ public abstract class Tool
|
|||||||
private void login()
|
private void login()
|
||||||
{
|
{
|
||||||
// TODO: Replace with call to ServiceRegistry
|
// TODO: Replace with call to ServiceRegistry
|
||||||
AuthenticationService auth = (AuthenticationService)appContext.getBean("authenticationService");
|
AuthenticationService auth = (AuthenticationService) serviceRegistry.getAuthenticationService();
|
||||||
auth.authenticate(toolContext.getUsername(), toolContext.getPassword().toCharArray());
|
auth.authenticate(toolContext.getUsername(), toolContext.getPassword().toCharArray());
|
||||||
log("Connected as " + toolContext.getUsername());
|
log("Connected as " + toolContext.getUsername());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user