Index: tmp/org.txm.libs.cqp/.project
===================================================================
--- tmp/org.txm.libs.cqp/.project	(revision 0)
+++ tmp/org.txm.libs.cqp/.project	(revision 396)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.libs.cqp</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: tmp/org.txm.libs.cqp/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/Activator.java
===================================================================
--- tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/Activator.java	(revision 0)
+++ tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/Activator.java	(revision 396)
@@ -0,0 +1,61 @@
+package org.txm.libs.cqp;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "CQP"; //$NON-NLS-1$
+
+	// The shared instance
+	private static Activator plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return imageDescriptorFromPlugin(PLUGIN_ID, path);
+	}
+}

Property changes on: tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/Activator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/CQPPreferences.java
===================================================================
--- tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/CQPPreferences.java	(revision 0)
+++ tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/CQPPreferences.java	(revision 396)
@@ -0,0 +1,18 @@
+package org.txm.libs.cqp;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.osgi.service.prefs.Preferences;
+import org.txm.core.preferences.TXMPreferences;
+
+public class CQPPreferences extends TXMPreferences {
+
+	public static final String PREFERENCES_NODE = "cwbinstaller";
+	
+	public static final String VERSION = "cwbinstaller.commands.version";
+
+	@Override
+	public void initializeDefaultPreferences() {
+		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
+		preferences.put(VERSION, "0.0");
+	}
+}

Property changes on: tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/CQPPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/DoInstallStep.java
===================================================================
--- tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/DoInstallStep.java	(revision 0)
+++ tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/DoInstallStep.java	(revision 396)
@@ -0,0 +1,83 @@
+package org.txm.libs.cqp;
+
+import java.io.File;
+
+import org.eclipse.jface.util.Util;
+import org.osgi.framework.Version;
+import org.txm.PostInstallationStep;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.utils.BundleUtils;
+import org.txm.utils.logger.Log;
+
+public class DoInstallStep extends PostInstallationStep {
+	
+	protected String name = "corg.txm.libs.cqp.DoInstallStep"; //$NON-NLS-1$
+
+	@Override
+	public void install() {	
+		// nothing to do
+	}
+	
+	@Override
+	public void preInstall() {
+		
+		String CQPFRAGMENT = "CQP."+System.getProperty("osgi.os");
+		
+		Log.info("CQP.DoInstallStep.install()");
+		String saved = TXMPreferences.getString(CQPPreferences.PREFERENCES_NODE, CQPPreferences.VERSION, "");
+		Version currentVersion = BundleUtils.getBundleVersion(CQPFRAGMENT); // the CQPFRAGMENT plugin contains the right version
+		
+		if (saved != null && saved.length() > 0) {
+			Version savedVersion = new Version(saved);
+			if (currentVersion.compareTo(savedVersion) <= 0) {
+				Log.info("No post-installation of CQP to do");
+				return; // nothing to do
+			}
+		}
+		System.out.println("Updating CWB preferences for CQP version="+currentVersion);
+		
+		String os = "win";
+		String ext = "";
+		if (Util.isWindows()) { //$NON-NLS-1$
+			if (System.getProperty("os.arch").contains("64")) { os = "win64"; } 
+			else { os = "win32"; }
+			ext = ".exe";
+		} else if (Util.isMac()) { //$NON-NLS-1$
+			os = "macosx";
+		} else {
+			os = "linux32";
+			if (System.getProperty("os.arch").contains("64")) 
+				os = "linux64";
+		}
+
+		File bundleDir = BundleUtils.getBundleFile(CQPFRAGMENT);
+		if (bundleDir == null) {
+			System.out.println("Error while retrieving TreeTaggerInstaller bundle directory.");
+			return;
+		}
+		File cwbDir = new File(bundleDir, "res");
+		File initFile = new File(cwbDir, "cqpserver.init");
+		File OSDir = new File(cwbDir, os);
+		File execFile = new File(OSDir, "cqpserver"+ext);
+
+		TXMPreferences.putString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.CQI_SERVER_PATH_TO_CQPLIB, OSDir.getAbsolutePath());
+		TXMPreferences.putString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.CQI_SERVER_PATH_TO_INIT_FILE, initFile.getAbsolutePath());
+		TXMPreferences.putString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.CQI_SERVER_PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
+		if (!Util.isWindows()) { 
+			try {
+				Log.info("Setting execution file rights to: "+OSDir.getAbsolutePath());
+				Runtime.getRuntime().exec("chmod -R +x "+OSDir.getAbsolutePath()).waitFor();
+			} catch (Exception e) {
+				System.out.println("Error while setting execution file rights to: "+OSDir.getAbsolutePath());
+				e.printStackTrace();
+			}
+		}
+	
+		if (!execFile.canExecute()) {
+			System.out.println("File right setting error, cannot execute: "+execFile);
+		}
+		Log.warning("SearchEngine preferences set with: "+OSDir.getAbsolutePath()+ ", "+initFile.getAbsolutePath()+ " and "+execFile.getAbsolutePath());
+		TXMPreferences.putString(CQPPreferences.PREFERENCES_NODE, CQPPreferences.VERSION, currentVersion.toString());
+	}
+}

Property changes on: tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/DoInstallStep.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.libs.cqp/res/cqpserver.init
===================================================================
--- tmp/org.txm.libs.cqp/res/cqpserver.init	(revision 0)
+++ tmp/org.txm.libs.cqp/res/cqpserver.init	(revision 396)
@@ -0,0 +1,4 @@
+host *;               # allow access from any host (including localhost)
+
+# users must login with name "anonymous" and explicit "" as password!
+user anonymous "";
\ No newline at end of file
Index: tmp/org.txm.libs.cqp/build.properties
===================================================================
--- tmp/org.txm.libs.cqp/build.properties	(revision 0)
+++ tmp/org.txm.libs.cqp/build.properties	(revision 396)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

Property changes on: tmp/org.txm.libs.cqp/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.libs.cqp/plugin.xml
===================================================================
--- tmp/org.txm.libs.cqp/plugin.xml	(revision 0)
+++ tmp/org.txm.libs.cqp/plugin.xml	(revision 396)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.txm.postinstallationstep">
+      <PostInstallationStep
+            class="org.txm.libs.cqp.DoInstallStep"
+            description="Set CQP preferences"
+            name="org.txm.libs.cqp.DoInstallStep">
+      </PostInstallationStep>
+   </extension>
+
+</plugin>

Property changes on: tmp/org.txm.libs.cqp/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.libs.cqp/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- tmp/org.txm.libs.cqp/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ tmp/org.txm.libs.cqp/.settings/org.eclipse.jdt.core.prefs	(revision 396)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

Property changes on: tmp/org.txm.libs.cqp/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.libs.cqp/.classpath
===================================================================
--- tmp/org.txm.libs.cqp/.classpath	(revision 0)
+++ tmp/org.txm.libs.cqp/.classpath	(revision 396)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="res"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: tmp/org.txm.libs.cqp/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.libs.cqp/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.libs.cqp/META-INF/MANIFEST.MF	(revision 0)
+++ tmp/org.txm.libs.cqp/META-INF/MANIFEST.MF	(revision 396)
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CQP libs
+Bundle-SymbolicName: org.txm.libs.cqp;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.txm.libs.cqp.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.txm.core,
+ org.eclipse.ui.workbench,
+ org.eclipse.jface
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.txm.libs.cqp

Property changes on: tmp/org.txm.libs.cqp/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

