IDEMPIERE-3824 Implement apply packin from folder from command line

This commit is contained in:
Carlos Ruiz 2018-11-19 12:58:57 -02:00
parent 63472d7ca9
commit 21a89ab521
5 changed files with 182 additions and 0 deletions

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
<booleanAttribute key="append.args" value="true"/>
<stringAttribute key="application" value="org.adempiere.base.PackInFolderApplication"/>
<booleanAttribute key="askclear" value="true"/>
<booleanAttribute key="automaticAdd" value="false"/>
<booleanAttribute key="automaticValidate" value="true"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/packinfolder.app"/>
<booleanAttribute key="default" value="false"/>
<booleanAttribute key="includeOptional" value="false"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-packinfolder.app"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -arch ${target.arch} -nl ${target.nl} -consoleLog&#10;/home/carlos/srcFH/scm/fhca/dumps/2packs"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-DPropertyFile=/home/carlos/.idempiere/camaleo21pg.properties"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.adempiere.server.server_product"/>
<stringAttribute key="selected_target_plugins" value="bcprov@default:default,com.itextpdf@default:default,com.jaspersoft.studio.bundles.barbecue@default:default,com.jaspersoft.studio.bundles.poi@default:default,com.sun.mail.javax.mail@default:default,groovy-all@default:default,javax.activation@default:default,javax.ejb@default:default,javax.jms@default:default,javax.management.j2ee-api@default:default,javax.transaction@default:false,javax.xml.rpc@default:default,javax.xml.soap@default:default,javax.xml.stream@default:default,javax.xml@default:default,net.sf.supercsv.super-csv@default:default,org.apache.activemq.activemq-core@default:default,org.apache.activemq.kahadb@default:default,org.apache.ant@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.felix.scr@default:default,org.apache.poi@default:default,org.apache.servicemix.bundles.cglib@default:default,org.apache.servicemix.bundles.xmlbeans@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.cryptacular@default:default,org.dom4j@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@3:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.jetty.osgi-servlet-api@default:default,org.eclipse.jetty.osgi.alpn.fragment@default:false,org.eclipse.osgi.compatibility.plugins@default:false,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.jfree.chart-osgi@default:default,org.jfree.jcommon-osgi@default:default,org.junit@default:default,org.krysalis.barcode4j@default:default,org.passay@default:default,org.restlet@default:default,org.slf4j.api@default:default,org.slf4j.jcl@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base.process@default:default,org.adempiere.base@4:default,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.pipo.handlers@default:default,org.adempiere.pipo@3:true,org.adempiere.plugin.utils@3:true,org.apache.ecs@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default,org.slf4j.jdk14@default:false"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
<booleanAttribute key="useProduct" value="false"/>
</launchConfiguration>

View File

@ -128,4 +128,16 @@
</run>
</application>
</extension>
<extension
id="org.adempiere.base.PackInFolderApplication"
point="org.eclipse.core.runtime.applications">
<application
cardinality="singleton-global"
thread="main"
visible="true">
<run
class="org.adempiere.base.PackInFolderApplication">
</run>
</application>
</extension>
</plugin>

View File

@ -0,0 +1,88 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz (sponsored by FH) *
**********************************************************************/
package org.adempiere.base;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.Adempiere;
import org.compiere.model.MPInstance;
import org.compiere.process.ProcessCall;
import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogMgt;
import org.compiere.util.Env;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
/**
* @author Carlos Ruiz (globalqss)
*
*/
public class PackInFolderApplication implements IApplication {
/* (non-Javadoc)
* @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
*/
@Override
public Object start(IApplicationContext context) throws Exception {
Adempiere.startup(false);
CLogMgt.setLevel(Level.FINE);
Map<?, ?> args = context.getArguments();
String commandlineArgs[] = (String[]) args.get("application.args");
if (commandlineArgs.length == 1) {
Properties ctx = Env.getCtx();
String directory = commandlineArgs[0];
ProcessInfo pi = new ProcessInfo("PackInFolder", 200099);
pi.setAD_Client_ID(0);
pi.setAD_User_ID(100);
MPInstance instance = new MPInstance(ctx, 200099, 0);
instance.saveEx();
instance.createParameter(10, "Folder", directory);
pi.setAD_PInstance_ID(instance.getAD_PInstance_ID());
ProcessCall process = Core.getProcess("org.adempiere.pipo2.PackInFolder");
process.startProcess(ctx, pi, null);
StringBuilder msgout = new StringBuilder("Process=").append(pi.getTitle())
.append(" Error=").append(pi.isError()).append(" Summary=")
.append(pi.getSummary());
System.out.println(msgout.toString());
} else {
System.out.println("Apply PackIn from Folder usage:");
System.out.println("RUN_ApplyPackInFromFolder.sh folder");
}
return IApplication.EXIT_OK;
}
/* (non-Javadoc)
* @see org.eclipse.equinox.app.IApplication#stop()
*/
@Override
public void stop() {
}
}

View File

@ -0,0 +1,35 @@
#!/bin/sh
if [ $IDEMPIERE_HOME ]; then
cd $IDEMPIERE_HOME/utils
else
cd "`dirname $0`"
fi
. ./myEnvironment.sh Server
if [ $JAVA_HOME ]; then
JAVA=$JAVA_HOME/bin/java
else
JAVA=java
fi
# $Id: RUN_ApplyPackInFromFolder.sh
echo Apply PackIn from Folder - $IDEMPIERE_HOME \($ADEMPIERE_DB_NAME\)
if [ $# -eq 1 ]
then
export DIRECTORY=$1
else
echo "Usage: $0 folder"
exit 1
fi
cd ..
echo This Procedure import packin files from directory $DIRECTORY
$JAVA -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=false -jar plugins/org.eclipse.equinox.launcher_1.*.jar -application org.adempiere.base.PackInFolderApplication $DIRECTORY
echo Done
echo .
echo For problems, check log file in base directory

View File

@ -0,0 +1,14 @@
@Rem $Id: RUN_ApplyPackInFromFolder.bat
@if (%IDEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %IDEMPIERE_HOME%\utils\myEnvironment.bat Server)
@Title Import Translation - %IDEMPIERE_HOME% (%ADEMPIERE_DB_NAME%)
@SET DIRECTORY=%1
@echo This Procedure import packin files from directory %DIRECTORY%
@pause
FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c
@"%JAVA_HOME%\bin\java" -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=false -jar %JARFILE% -application org.adempiere.base.PackInFolderApplication %DIRECTORY%
@pause