Révision 777

tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartEnginesManager.java (revision 777)
1
package org.txm.chartsengine.core;
2

  
3
import org.eclipse.core.runtime.IProgressMonitor;
4
import org.txm.EngineType;
5
import org.txm.EnginesManager;
6
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
7
import org.txm.core.preferences.TXMPreferences;
8

  
9
public class ChartEnginesManager extends EnginesManager<ChartsEngine> {
10

  
11
	@Override
12
	protected boolean fetchEngines() {
13
		try {
14
			// creates charts engine
15
			ChartsEngine.createChartsEngines();
16
			ChartsEngine.setCurrrentChartsEngine(TXMPreferences.getString(ChartsEnginePreferences.CURRENT_NAME, ChartsEnginePreferences.PREFERENCES_NODE));
17
			
18
			TXMPreferences.alternativeNodesQualifiers.add(ChartsEnginePreferences.PREFERENCES_NODE);
19

  
20
		} catch (Throwable e) {
21
			e.printStackTrace();
22
			return false;
23
		}
24
		return true;
25
	}
26

  
27
	@Override
28
	public boolean startEngines(IProgressMonitor monitor) {
29
		// TODO Auto-generated method stub
30
		return false;
31
	}
32

  
33
	@Override
34
	public boolean stopEngines() {
35
		// TODO Auto-generated method stub
36
		return false;
37
	}
38

  
39
	@Override
40
	public EngineType getEnginesType() {
41
		// TODO Auto-generated method stub
42
		return null;
43
	}
44

  
45
}
0 46

  
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java (revision 777)
12 12
import org.eclipse.core.runtime.IExtensionPoint;
13 13
import org.eclipse.core.runtime.Platform;
14 14
import org.eclipse.core.runtime.RegistryFactory;
15
import org.txm.Engine;
15 16
import org.txm.chartsengine.core.messages.ChartsEngineCoreMessages;
16 17
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
17 18
import org.txm.chartsengine.core.results.ChartResult;
......
26 27
 * @author sjacquot
27 28
 *
28 29
 */
29
public abstract class ChartsEngine {
30
public abstract class ChartsEngine implements Engine {
30 31
	
31
	// FIXME: should be done in an activator?
32
	static	{
33
		// creates charts engine
34
		ChartsEngine.createChartsEngines();
35
		ChartsEngine.setCurrrentChartsEngine(TXMPreferences.getString(ChartsEnginePreferences.CURRENT_NAME, ChartsEnginePreferences.PREFERENCES_NODE));
36
		
37
		TXMPreferences.alternativeNodesQualifiers.add(ChartsEnginePreferences.PREFERENCES_NODE);
38

  
39
	}
40
	
41 32
	public final static String extensionPointId = "org.txm.chartsengine.chartsengine"; //$NON-NLS-1$
42 33
	
43 34
	/**
tmp/org.txm.chartsengine.core/plugin.xml (revision 777)
9 9
            class="org.txm.chartsengine.core.preferences.ChartsEnginePreferences">
10 10
      </initializer>
11 11
   </extension>
12
   <extension
13
         point="org.txm.EnginesManager">
14
      <EngineManager
15
            class="org.txm.chartsengine.core.ChartEnginesManager"
16
            description="chart engines manager"
17
            name="org.txm.chartsengine.core.ChartEnginesManager">
18
      </EngineManager>
19
   </extension>
12 20

  
13 21
</plugin>
tmp/org.txm.annotation.core/build.properties (revision 777)
1
source.. = src/
1 2
output.. = bin/
2 3
bin.includes = plugin.xml,\
3
               libs/hsqldb.jar,\
4
               libs/postgresql-9.4.1207.jre6.jar,\
5
               libs/sqlite-jdbc-3.8.11.2.jar,\
4
               META-INF/,\
6 5
               .,\
7
               source.. = src/,\
8
               bin/
6
               libs/
7

  
tmp/org.txm.annotation.core/plugin.xml (revision 777)
4 4
   <extension-point id="org.txm.annotation.core.AnnotationEngine" name="org.txm.annotation.core.AnnotationEngine" schema="schema/org.txm.annotation.core.AnnotationEngine.exsd"/>
5 5
   <extension
6 6
         point="org.txm.EnginesManager">
7
      <EngineManager
8
            class="org.txm.annotation.core.AnnotationEngines"
9
            description="description"
10
            name="org.txm.annotation.core.AnnotationEngines">
11
      </EngineManager>
7 12
   </extension>
8 13
   <extension
9 14
         point="org.eclipse.core.runtime.preferences">
tmp/org.txm.annotation.core/META-INF/MANIFEST.MF (revision 777)
15 15
 org.eclipse.persistence.antlr;bundle-version="3.2.0";visibility:=reexport,
16 16
 org.eclipse.osgi;bundle-version="3.10.2";visibility:=reexport,
17 17
 org.txm.searchengine.core;bundle-version="1.0.0";visibility:=reexport,
18
 org.eclipse.ui.workbench;visibility:=reexport,
19
 osgi.enterprise;bundle-version="4.2.0";visibility:=reexport,
20
 org.eclipse.jst.common.frameworks;bundle-version="1.1.601"
18
 org.eclipse.ui.workbench;visibility:=reexport
21 19
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
22 20
Bundle-ActivationPolicy: lazy
23 21
Export-Package: org.hsqldb,
tmp/org.txm.annotation.core/src/org/txm/annotation/core/AnnotationEngines.java (revision 777)
1 1
package org.txm.annotation.core;
2 2

  
3 3
import org.eclipse.core.runtime.IProgressMonitor;
4
import org.txm.Engine;
5 4
import org.txm.EngineType;
6 5
import org.txm.EnginesManager;
7 6

  
8
public abstract class AnnotationEngines extends EnginesManager<Engine> {
7
public abstract class AnnotationEngines extends EnginesManager<AnnotationEngine> {
9 8
	
10 9
	public AnnotationEngines() {
11 10
		
......
14 13
	@Override
15 14
	public boolean startEngines(IProgressMonitor monitor) {
16 15
		
17
		for (Engine e : engines.values()) {
16
		for (AnnotationEngine e : engines.values()) {
17
			System.out.println(e);
18 18
//			AnnotationEngine se = (AnnotationEngine)e;
19 19
//			if (monitor != null) monitor.subTask("Starting "+ se.getName()+" annotation engine.");
20 20
//			try {
......
28 28

  
29 29
	@Override
30 30
	public boolean stopEngines() {
31
		for (Engine e : engines.values()) {
31
		for (AnnotationEngine e : engines.values()) {
32
			System.out.println(e);
32 33
//			AnnotationEngine se = (AnnotationEngine)e;
33 34
//			System.out.println("Stoping "+ se.getName()+" annotation engine.");
34 35
//			try {
tmp/org.txm.para.core/build.properties (revision 777)
1 1
source.. = src/
2 2
output.. = bin/
3 3
bin.includes = META-INF/,\
4
               .
4
               .,\
5
               plugin.xml
tmp/org.txm.para.core/plugin.xml (revision 777)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4

  
5
</plugin>
0 6

  
tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 777)
97 97
		Log.info("Fetching engine managers...");
98 98
		engines.clear();
99 99
		//System.out.println("Contributions of "+EnginesManager.ENGINEMANAGER_EXTENSION_POINT_ID);
100
		Platform.getExtensionRegistry().getExtensionPoints();
100 101
		IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(EnginesManager.ENGINEMANAGER_EXTENSION_POINT_ID);
101 102
		//System.out.println("contributions: "+Arrays.toString(contributions));
102 103
		for (int i = 0; i < contributions.length; i++) {
103 104
			try {
104
				Log.info("Registering engine: "+contributions[i].getName());
105
				Log.info("Registering engine manager: "+contributions[i].getName());
105 106
				EnginesManager<?> engine = (EnginesManager<?>)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
106 107
				if (engine.fetchEngines()) {
107 108
					//System.out.println("add engine: "+engine);
......
109 110
				} else {
110 111
					System.out.println(""+engine+" had no engine. Aborting its installation.");
111 112
				}
112
			} catch(CoreException e) {
113
			} catch(Throwable e) {
113 114
				e.printStackTrace();
114 115
			} 
115 116
		}
tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 777)
126 126
			if (!writeEmptyWorkspaceFile(xmlfile)) {
127 127
				System.out.println("Error while creating workspace definition file: "+xmlfile);
128 128
			}
129
			
130
			String path = TXMPreferences.getString(TBXPreferences.INSTALL_DIR, TBXPreferences.PREFERENCES_NODE);
131
			File installDirectory = new File(path);
132
			if (!installDirectory.exists()) {
133
				System.out.println("Error: Workspace cannot found install directory: "+installDirectory.getAbsolutePath());
134
				return null;
135
			}
136
			
137
			File redistDirectory = new File(installDirectory, "redist");
138
			if (!redistDirectory.exists()) {
139
				System.out.println("Error: Workspace cannot found redist directory: "+redistDirectory.getAbsolutePath());
140
				return null;
141
			}
142
			
143
			FileCopy.copyFiles(redistDirectory, txmhomedir);
129 144

  
130
			// the folders to copy from TXM install dir
131
			BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "xsl", txmhomedir);
132
			BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "schema", txmhomedir);
133
			BundleUtils.copyFiles("org.txm.core", "res", "org/txm", "css", txmhomedir);
145
//			// the folders to copy from TXM install dir
146
//			BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "xsl", txmhomedir);
147
//			BundleUtils.copyFiles("org.txm.core", "res", "org/txm/xml", "schema", txmhomedir);
148
//			BundleUtils.copyFiles("org.txm.core", "res", "org/txm", "css", txmhomedir);
134 149

  
135 150
			Workspace workspace = new Workspace(xmlfile);
136 151
			workspace.save();
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartsEngine.java (revision 777)
10 10
import java.io.IOException;
11 11
import java.util.ArrayList;
12 12

  
13
import org.eclipse.core.runtime.IProgressMonitor;
13 14
import org.jfree.chart.ChartFactory;
14 15
import org.jfree.chart.JFreeChart;
15 16
import org.jfree.chart.axis.NumberAxis;
......
1581 1582
	}
1582 1583

  
1583 1584

  
1585

  
1586
	@Override
1587
	public boolean getState() {
1588
		// TODO Auto-generated method stub
1589
		return false;
1590
	}
1591

  
1592

  
1593

  
1594
	@Override
1595
	public boolean initialize() throws Exception {
1596
		// TODO Auto-generated method stub
1597
		return false;
1598
	}
1599

  
1600

  
1601

  
1602
	@Override
1603
	public boolean start(IProgressMonitor monitor) throws Exception {
1604
		// TODO Auto-generated method stub
1605
		return false;
1606
	}
1607

  
1608

  
1609

  
1610
	@Override
1611
	public boolean stop() throws Exception {
1612
		// TODO Auto-generated method stub
1613
		return false;
1614
	}
1615

  
1616

  
1584 1617
// FIXME: old version
1585 1618
//	/**
1586 1619
//	 * Constrains axes ticks to square aspect ratio.
tmp/org.txm.chartsengine.jfreechart.core/build.properties (revision 777)
1 1
source.. = src/
2 2
output.. = bin/
3 3
bin.includes = META-INF/,\
4
               .
4
               .,\
5
               plugin.xml
tmp/org.txm.progression.rcp/META-INF/MANIFEST.MF (revision 777)
2 2
Bundle-ManifestVersion: 2
3 3
Bundle-Name: %Bundle-Name
4 4
Bundle-SymbolicName: org.txm.progression.rcp;singleton:=true
5
Bundle-Version: 1.0.0.qualifier
5
Bundle-Version: 1.0.0.v_qualifier
6 6
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
7 7
Require-Bundle: org.txm.utils,
8 8
 org.eclipse.osgi;bundle-version="3.10.2",
tmp/org.txm.progression.rcp/build.properties (revision 777)
5 5
               plugin.xml,\
6 6
               icons/,\
7 7
               OSGI-INF/
8
forceContextQualifier=737
tmp/org.txm.libs.jfreechart/build.properties (revision 777)
2 2
               about.html,\
3 3
               about_files/,\
4 4
               lib/jcommon-1.0.21.jar,\
5
               lib/jfreechart-1.0.17.jar
5
               lib/jfreechart-1.0.17.jar,\
6
               .
tmp/org.txm.libs.jfreechart/META-INF/MANIFEST.MF (revision 777)
60 60
 org.jfree.util
61 61
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
62 62
Bundle-Vendor: www.jfree.org
63
Bundle-ClassPath: lib/jcommon-1.0.21.jar,
63
Bundle-ClassPath: .,
64
 lib/jcommon-1.0.21.jar,
64 65
 lib/jfreechart-1.0.17.jar
tmp/org.txm.rcp.feature/build.properties (revision 777)
1 1
bin.includes = feature.xml,\
2 2
               EMPTYTXMHOME/,\
3 3
               TXM.sh
4

  
4 5
root.linux.gtk.x86_64 = linux/
5 6
root.linux.gtk.x86_64.permissions.755 = jre/bin/java
7

  
6 8
root.macosx.cocoa.x86_64 = mac/
7
root.win32.win32.x86_64 = win/,../org.txm.libs.cqp.win32/res/win64/dependencies/
8
root.win32.win32.x86_64.folder._redist/css = ../org.txm.core/res/org/txm/css/
9
root.win32.win32.x86_64.folder._redist/xsl = ../org.txm.core/res/org/txm/xml/xsl/
10
root.win32.win32.x86_64.folder._redist/schema = ../org.txm.core/res/org/txm/xml/schema/
11
root.win32.win32.x86_64.folder._redist/scripts/samples/R = ../org.txm.statsengine.r.core/R/
12
root.win32.win32.x86_64.folder.samples = ../org.txm.setups/shared/all/samples/
9

  
10
root.win32.win32.x86_64 = win/,\
11
						../org.txm.libs.cqp.win32/res/win64/dependencies/
12
						
13
root.folder.redist/css = ../org.txm.core/res/org/txm/css/
14
root.folder.redist/xsl = ../org.txm.core/res/org/txm/xml/xsl/
15
root.folder.redist/schema = ../org.txm.core/res/org/txm/xml/schema/
16

  
17
#root.win32.win32.x86_64.folder._redist/scripts/samples/R = ../org.txm.statsengine.r.core/R/
18

  
19
root = ../org.txm.setups/shared/all
tmp/org.txm.rcp.feature/linux/install.bash (revision 777)
1
#!/bin/bash
2
TXMINSTALLDIR="/usr/lib/TXM"
3
ARCHIVEPATH=`readlink -f "$1"`
4

  
5
USEZENITY=true
6
# X11 tests
7
if [ ${DISPLAY:-foobartxtm} == foobartxm ] ; then 
8
	echo "use shell" ; 
9
	USEZENITY=false;
10
else 
11
	echo "try to use display '$DISPLAY'" ; 
12
	xprop -root >/dev/null &>/dev/null # pour lancer la commande sans afficher de sortie 
13
	if [ $? != 0 ];then
14
		echo "use shell"
15
		USEZENITY=false;
16
	else
17
		echo "use zenity"
18
	fi
19
fi 
20

  
21
function question() {
22
# $1: message
23
# $2: ok message
24
# $3: cancel message
25
if ( $USEZENITY ) ; then
26
	echo "** TXM install : Question: $1"
27
	zenity --question --text="$1" --ok-label="$2" --cancel-label="$3";
28
	return $?
29
else
30
	echo "** TXM install : Question: $1"
31
	echo "$2 OR $3 = Y OR n ?"
32
	read LINE
33
	if [ "$LINE" = "Y" ];then
34
		return 0;
35
	else
36
		return 1;
37
	fi
38
fi
39
} 
40

  
41
function error() {
42
# $1: message
43
echo "** TXM install : Error: $1";
44
if ( $USEZENITY ) ; then
45
	zenity --error --text="$1";
46
fi
47
} 
48

  
49
echo "use zenity : $USEZENITY"
50

  
51
# Test usage
52
USAGE="** TXMinstall: usage: install.sh <Install source directory>"
53
if [ $# != 1 ]; then
54
	echo "$USAGE"
55
	exit 1;
56
fi
57

  
58
# Test if java exists
59
java -version
60
if [ $? != 0 ]; then
61
	echo "** TXM install: Could not find java. Aborting."
62
	exit 1;
63
fi
64

  
65
# Test if TestArchi.jar exists
66
if [ ! -f "$ARCHIVEPATH/TestPreInstall.jar" ]; then
67
	echo "** TXM install: TestArchi.jar is missing $ARCHIVEPATH/TestPreInstall.jar. Can't continue the installation."
68
	exit 1;
69
fi
70

  
71
# Test is javaversion os and arch match to the setup
72
java -jar "$ARCHIVEPATH/TestPreInstall.jar" 1.6.0 i386 Linux
73
if [ $? != 0 ]; then
74
	echo "** TXM install: It seems that TXM setup is not appropriate for your system. Still continue ?"
75
	echo "Type Y to continue and n to stop installation. Y/n ?"
76
	read LINE
77
	if [ "$LINE" = "n" ];then
78
		exit 1
79
	fi
80
fi
81

  
82
# Test if ARCHIVEPATH exists
83
if [ ! -d "$ARCHIVEPATH" ]; then
84
	echo "** TXM install: archive $ARCHIVEPATH does not exist or is not a directory. Can't continue the installation."
85
	exit 1;
86
fi
87

  
88

  
89

  
90
# License agreement
91
question "`cat $TXMINSTALLDIR/license.txt`" "I agree" "Cancel"
92
if [ $? != 0 ];then
93
	echo "** TXM install: abort"
94
	exit 1;
95
fi
96

  
97
echo "** TXM install: This script will now delete and create the 'TXM' directory in the directory ($TXMINSTALLDIR), create a link to the TXM binary and install R if it is not already installed."
98
echo "** TXM install: Continue ? (Y/n)"
99

  
100
read LINE
101
if [ "$LINE" = "Y" ];then
102
	echo ""
103
else
104
	echo "** TXM install: abort"
105
	exit;
106
fi
107

  
108
# install R & packages
109
echo "** TXM install: Install R packages"
110
if [ `which R` ];then 
111
	echo ""
112
else
113
	aptitude install r-base
114
fi 
115

  
116
sudo R --no-save < "$TXMINSTALLDIR/R/rlibs.R"
117

  
118
if [ $? != 0 ]; then
119
	error "** TXM install: R packages installation failed. Aborting."
120
	exit 1;
121
fi
122

  
123
echo "** TXM install: Removing $TXMINSTALLDIR..."
124
		rm -rf "$TXMINSTALLDIR"
125
		if [ $? != 0 ]; then
126
			echo "** TXM install: error in 'rm -rf $TXMINSTALLDIR', aborting."
127
			exit 1 ;
128
		fi
129

  
130
# create TXM install dir
131
mkdir "$TXMINSTALLDIR"
132
if [ $? != 0 ]; then
133
	echo "** TXM install: creation of directory TXMINSTALLDIR '$TXMINSTALLDIR' failed. Aborting."
134
	exit 1;
135
fi
136

  
137
# copy archive
138
echo "** TXM install: Copy files into TXM install directory"
139
cp -rf "$ARCHIVEPATH"/* "$TXMINSTALLDIR"
140
if [ $? != 0 ]; then
141
	echo "** TXM install: TXMinstallation files copy failed. Aborting."
142
	exit 1;
143
fi
144

  
145
# create launcher
146
echo "** TXM install: create the TXM launcher"
147
rm -fv "/usr/local/bin/TXM"
148
rm -fv "/usr/bin/TXM" && \
149
cp "$ARCHIVEPATH/TXMexec" "/usr/bin" && \
150
mv "/usr/bin/TXMexec" "/usr/bin/TXM"
151

  
152
if [ $? != 0 ]; then
153
	echo "** TXM install: Failed to create TXM launcher. Aborting."
154
	exit 1;
155
fi
156

  
157
echo "** TXM install: Create preferences file"
158
optExec="cqi_server_path_to_executable"
159
pathToCqp="$TXMINSTALLDIR/cwb/bin/cqpserver"
160
optInit="cqi_server_path_to_init_file"
161
pathToInit="$TXMINSTALLDIR/cwb/cqpserver.init"
162
optPathToR="r_path_to_executable"
163
pathToR=`which R`
164
optPathToTT="TREETAGGER_INSTALL_PATH"
165
pathToTT="$TXMINSTALLDIR/treetagger"
166
optPathToTTMod="TREETAGGER_MODELS_PATH"
167
pathToTTMod="$TXMINSTALLDIR/treetagger/models"
168

  
169
# create STAMP
170
touch "$TXMINSTALLDIR/STAMP"
171

  
172
# set executable files
173
chmod +x "$TXMINSTALLDIR/TXM"
174
chmod +x "$TXMINSTALLDIR/cwb/bin"/*
175

  
176
# set preferences
177
PREF_FILE="$TXMINSTALLDIR/install.prefs"
178
touch "$PREF_FILE"
179
echo $optExec"="$pathToCqp >> "$PREF_FILE"
180
echo $optInit"="$pathToInit >> "$PREF_FILE"
181
echo $optPathToR"="$pathToR >> "$PREF_FILE"
182
echo $optPathToTT"="$pathToTT >> "$PREF_FILE"
183
echo $optPathToTTMod"="$pathToTTMod >> "$PREF_FILE"
184
# set tools' default options
185
echo "ca_show_individuals=true" >> "$PREF_FILE"
186
echo "ca_show_variables=false" >> "$PREF_FILE"
187
echo "ca_quality_display=.00" >> "$PREF_FILE"
188
echo "ca_mass_display=###.00" >> "$PREF_FILE"
189
echo "ca_dist_display=#.00" >> "$PREF_FILE"
190
echo "ca_contrib_display=###.00" >> "$PREF_FILE"
191
echo "ca_cos2_display=.00" >> "$PREF_FILE"
192
echo "ca_coord_display=#.00" >> "$PREF_FILE"
193
echo "cooc_scoreformat=E00" >> "$PREF_FILE"
194
echo "cooc_minfreq=2" >> "$PREF_FILE"
195
echo "cooc_mincount=2" >> "$PREF_FILE"
196
echo "diag_max_value=20" >> "$PREF_FILE"
197
echo "lt_fmin=2" >> "$PREF_FILE"
198
echo "r_file_transfert=false" >> "$PREF_FILE"
199

  
200
touch "$TXMINSTALLDIR/STAMP"
201

  
202
if [ $? != 0 ]; then
203
	error "** TXM install: Failed to create install TIMESTAMP file : $TXMINSTALLDIR/STAMP"
204
	exit 1;
205
fi
206

  
207
echo "** TXM install: done, type TXM& in a terminal to launch the application"
208

  
209
exit 0
tmp/org.txm.setups/shared/debian/usr/lib/TXM/install.bash (revision 777)
1
#!/bin/bash
2
TXMINSTALLDIR="/usr/lib/TXM"
3
ARCHIVEPATH=`readlink -f "$1"`
4

  
5
USEZENITY=true
6
# X11 tests
7
if [ ${DISPLAY:-foobartxtm} == foobartxm ] ; then 
8
	echo "use shell" ; 
9
	USEZENITY=false;
10
else 
11
	echo "try to use display '$DISPLAY'" ; 
12
	xprop -root >/dev/null &>/dev/null # pour lancer la commande sans afficher de sortie 
13
	if [ $? != 0 ];then
14
		echo "use shell"
15
		USEZENITY=false;
16
	else
17
		echo "use zenity"
18
	fi
19
fi 
20

  
21
function question() {
22
# $1: message
23
# $2: ok message
24
# $3: cancel message
25
if ( $USEZENITY ) ; then
26
	echo "** TXM install : Question: $1"
27
	zenity --question --text="$1" --ok-label="$2" --cancel-label="$3";
28
	return $?
29
else
30
	echo "** TXM install : Question: $1"
31
	echo "$2 OR $3 = Y OR n ?"
32
	read LINE
33
	if [ "$LINE" = "Y" ];then
34
		return 0;
35
	else
36
		return 1;
37
	fi
38
fi
39
} 
40

  
41
function error() {
42
# $1: message
43
echo "** TXM install : Error: $1";
44
if ( $USEZENITY ) ; then
45
	zenity --error --text="$1";
46
fi
47
} 
48

  
49
echo "use zenity : $USEZENITY"
50

  
51
# Test usage
52
USAGE="** TXMinstall: usage: install.sh <Install source directory>"
53
if [ $# != 1 ]; then
54
	echo "$USAGE"
55
	exit 1;
56
fi
57

  
58
# Test if java exists
59
java -version
60
if [ $? != 0 ]; then
61
	echo "** TXM install: Could not find java. Aborting."
62
	exit 1;
63
fi
64

  
65
# Test if TestArchi.jar exists
66
if [ ! -f "$ARCHIVEPATH/TestPreInstall.jar" ]; then
67
	echo "** TXM install: TestArchi.jar is missing $ARCHIVEPATH/TestPreInstall.jar. Can't continue the installation."
68
	exit 1;
69
fi
70

  
71
# Test is javaversion os and arch match to the setup
72
java -jar "$ARCHIVEPATH/TestPreInstall.jar" 1.6.0 i386 Linux
73
if [ $? != 0 ]; then
74
	echo "** TXM install: It seems that TXM setup is not appropriate for your system. Still continue ?"
75
	echo "Type Y to continue and n to stop installation. Y/n ?"
76
	read LINE
77
	if [ "$LINE" = "n" ];then
78
		exit 1
79
	fi
80
fi
81

  
82
# Test if ARCHIVEPATH exists
83
if [ ! -d "$ARCHIVEPATH" ]; then
84
	echo "** TXM install: archive $ARCHIVEPATH does not exist or is not a directory. Can't continue the installation."
85
	exit 1;
86
fi
87

  
88

  
89

  
90
# License agreement
91
question "`cat $TXMINSTALLDIR/license.txt`" "I agree" "Cancel"
92
if [ $? != 0 ];then
93
	echo "** TXM install: abort"
94
	exit 1;
95
fi
96

  
97
echo "** TXM install: This script will now delete and create the 'TXM' directory in the directory ($TXMINSTALLDIR), create a link to the TXM binary and install R if it is not already installed."
98
echo "** TXM install: Continue ? (Y/n)"
99

  
100
read LINE
101
if [ "$LINE" = "Y" ];then
102
	echo ""
103
else
104
	echo "** TXM install: abort"
105
	exit;
106
fi
107

  
108
# install R & packages
109
echo "** TXM install: Install R packages"
110
if [ `which R` ];then 
111
	echo ""
112
else
113
	aptitude install r-base
114
fi 
115

  
116
sudo R --no-save < "$TXMINSTALLDIR/R/rlibs.R"
117

  
118
if [ $? != 0 ]; then
119
	error "** TXM install: R packages installation failed. Aborting."
120
	exit 1;
121
fi
122

  
123
echo "** TXM install: Removing $TXMINSTALLDIR..."
124
		rm -rf "$TXMINSTALLDIR"
125
		if [ $? != 0 ]; then
126
			echo "** TXM install: error in 'rm -rf $TXMINSTALLDIR', aborting."
127
			exit 1 ;
128
		fi
129

  
130
# create TXM install dir
131
mkdir "$TXMINSTALLDIR"
132
if [ $? != 0 ]; then
133
	echo "** TXM install: creation of directory TXMINSTALLDIR '$TXMINSTALLDIR' failed. Aborting."
134
	exit 1;
135
fi
136

  
137
# copy archive
138
echo "** TXM install: Copy files into TXM install directory"
139
cp -rf "$ARCHIVEPATH"/* "$TXMINSTALLDIR"
140
if [ $? != 0 ]; then
141
	echo "** TXM install: TXMinstallation files copy failed. Aborting."
142
	exit 1;
143
fi
144

  
145
# create launcher
146
echo "** TXM install: create the TXM launcher"
147
rm -fv "/usr/local/bin/TXM"
148
rm -fv "/usr/bin/TXM" && \
149
cp "$ARCHIVEPATH/TXMexec" "/usr/bin" && \
150
mv "/usr/bin/TXMexec" "/usr/bin/TXM"
151

  
152
if [ $? != 0 ]; then
153
	echo "** TXM install: Failed to create TXM launcher. Aborting."
154
	exit 1;
155
fi
156

  
157
echo "** TXM install: Create preferences file"
158
optExec="cqi_server_path_to_executable"
159
pathToCqp="$TXMINSTALLDIR/cwb/bin/cqpserver"
160
optInit="cqi_server_path_to_init_file"
161
pathToInit="$TXMINSTALLDIR/cwb/cqpserver.init"
162
optPathToR="r_path_to_executable"
163
pathToR=`which R`
164
optPathToTT="TREETAGGER_INSTALL_PATH"
165
pathToTT="$TXMINSTALLDIR/treetagger"
166
optPathToTTMod="TREETAGGER_MODELS_PATH"
167
pathToTTMod="$TXMINSTALLDIR/treetagger/models"
168

  
169
# create STAMP
170
touch "$TXMINSTALLDIR/STAMP"
171

  
172
# set executable files
173
chmod +x "$TXMINSTALLDIR/TXM"
174
chmod +x "$TXMINSTALLDIR/cwb/bin"/*
175

  
176
# set preferences
177
PREF_FILE="$TXMINSTALLDIR/install.prefs"
178
touch "$PREF_FILE"
179
echo $optExec"="$pathToCqp >> "$PREF_FILE"
180
echo $optInit"="$pathToInit >> "$PREF_FILE"
181
echo $optPathToR"="$pathToR >> "$PREF_FILE"
182
echo $optPathToTT"="$pathToTT >> "$PREF_FILE"
183
echo $optPathToTTMod"="$pathToTTMod >> "$PREF_FILE"
184
# set tools' default options
185
echo "ca_show_individuals=true" >> "$PREF_FILE"
186
echo "ca_show_variables=false" >> "$PREF_FILE"
187
echo "ca_quality_display=.00" >> "$PREF_FILE"
188
echo "ca_mass_display=###.00" >> "$PREF_FILE"
189
echo "ca_dist_display=#.00" >> "$PREF_FILE"
190
echo "ca_contrib_display=###.00" >> "$PREF_FILE"
191
echo "ca_cos2_display=.00" >> "$PREF_FILE"
192
echo "ca_coord_display=#.00" >> "$PREF_FILE"
193
echo "cooc_scoreformat=E00" >> "$PREF_FILE"
194
echo "cooc_minfreq=2" >> "$PREF_FILE"
195
echo "cooc_mincount=2" >> "$PREF_FILE"
196
echo "diag_max_value=20" >> "$PREF_FILE"
197
echo "lt_fmin=2" >> "$PREF_FILE"
198
echo "r_file_transfert=false" >> "$PREF_FILE"
199

  
200
touch "$TXMINSTALLDIR/STAMP"
201

  
202
if [ $? != 0 ]; then
203
	error "** TXM install: Failed to create install TIMESTAMP file : $TXMINSTALLDIR/STAMP"
204
	exit 1;
205
fi
206

  
207
echo "** TXM install: done, type TXM& in a terminal to launch the application"
208

  
209
exit 0
tmp/org.txm.core.tests/src/org/txm/core/tests/junit/PluginBuildProperties.java (revision 777)
1
package org.txm.core.tests.junit;
2

  
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.HashMap;
6
import java.util.Properties;
7

  
8
import org.txm.utils.io.IOUtils;
9

  
10
public class PluginBuildProperties extends TXMPluginTest {
11

  
12
	HashMap<String, HashMap<String, String>> ext_points = new HashMap<String, HashMap<String, String>>();
13

  
14
	@Override
15
	public void TBXPluginTest(File projectDirectory, String name, String packagePath) throws IOException {
16
		testPluginXMLExport(projectDirectory);
17
	}
18

  
19
	@Override
20
	public void RCPPluginTest(File projectDirectory, String name, String packagePath) throws IOException {
21
		File pluginXML = new File(projectDirectory, "plugin.xml");
22
		if (!pluginXML.exists()) {
23
			error("missing file "+pluginXML);
24
		}
25

  
26
		testPluginXMLExport(projectDirectory);
27
	}
28

  
29
	private void testPluginXMLExport(File projectDirectory) throws IOException {
30
		File pluginXML = new File(projectDirectory, "plugin.xml");
31
		File buildFile = new File(projectDirectory, "build.properties");
32
		
33
		if (!buildFile.exists()) {
34
			error("no build.properties: "+buildFile.getAbsolutePath());
35
			return;
36
		}
37
		
38
		if (!pluginXML.exists()) {
39
			error("no plugin.xml: "+pluginXML.getAbsolutePath());
40
			return;
41
		}
42
		
43
		Properties props = new Properties();
44
		props.load(IOUtils.getReader(buildFile));
45
		
46
		String value = (String) props.get("bin.includes");
47
		if (!value.contains("plugin.xml")) {
48
			error("plugin.xml is not exported: "+pluginXML.getAbsolutePath());
49
		}
50
	}
51

  
52
	@Override
53
	public void gatherData() {
54
	
55
	}
56
}
0 57

  
tmp/org.txm.core.tests/src/org/txm/core/tests/junit/TXMPluginTest.java (revision 777)
23 23
public abstract class TXMPluginTest {
24 24
	public static int LEVEL = 1; // 1 errors, 2 warnings, 3 infos messages
25 25
	int error = 0;
26
	
26

  
27 27
	protected ArrayList<File> projects;
28 28
	protected ArrayList<String> messages = new ArrayList<String>();
29
	
30
	
29

  
30

  
31 31
	public static File workspace = new File(System.getProperty("user.home"), "workspace079");
32 32

  
33 33
	/**
......
51 51
		Collections.sort(ret);
52 52
		return ret;
53 53
	}
54
	
54

  
55 55
	/**
56 56
	 * store and count error messages
57 57
	 * @param string
......
60 60
		if (LEVEL >= 1) messages.add("	ERROR	"+string);
61 61
		error++;
62 62
	}
63
	
63

  
64 64
	/**
65 65
	 * store warning messages
66 66
	 * @param string
......
68 68
	protected void warning(String string) {
69 69
		if (LEVEL >= 2) messages.add("	WARNING	"+string);
70 70
	}
71
	
71

  
72 72
	/**
73 73
	 * store info messages
74 74
	 * @param string
......
76 76
	protected void info(String string) {
77 77
		if (LEVEL >= 3) messages.add("	INFO	"+string);
78 78
	}
79
	
79

  
80 80
	/**
81 81
	 * All Test must starts with "super.test();" Usually ou don't need to Override this method
82 82
	 */
83 83
	@Test
84 84
	public void test() {
85
		
85

  
86 86
		System.out.print("Testing "+this.getClass().getSimpleName()+"...");
87 87
		try {
88
		projects = getProjects();
89
		
90
		if (projects.size() == 0) fail("No project found in "+workspace);
91
		
92
		gatherData();
93
		
94
		int nProjectMessage = 0;
95
		for (File projectDirectory : projects) {
96
			messages.clear();
97
			String plugin_name = projectDirectory.getName();
98
			String plugin_package = plugin_name.replace(".", "/");
99
			
100
			if (projectDirectory.getName().endsWith(".core")) {
101
				//plugin_package = plugin_package.substring(0, plugin_package.length()-5);
102
				TBXPluginTest(projectDirectory, plugin_name, plugin_package);
103
			} else if (projectDirectory.getName().endsWith(".rcp")) {
104
				//plugin_package = plugin_package.substring(0, plugin_package.length()-4);
105
				RCPPluginTest(projectDirectory, plugin_name, plugin_package);
106
			} else {
107
				// ignore project
108
			}
109
			
110
			if (messages.size() > 0) {
111
				if (nProjectMessage == 0) {
112
					System.out.println();
113
					nProjectMessage++;
88
			projects = getProjects();
89

  
90
			if (projects.size() == 0) fail("No project found in "+workspace);
91

  
92
			gatherData();
93

  
94
			int nProjectMessage = 0;
95
			for (File projectDirectory : projects) {
96
				messages.clear();
97
				String plugin_name = projectDirectory.getName();
98
				String plugin_package = plugin_name.replace(".", "/");
99

  
100
				if (projectDirectory.getName().endsWith(".core")) {
101
					//plugin_package = plugin_package.substring(0, plugin_package.length()-5);
102
					TBXPluginTest(projectDirectory, plugin_name, plugin_package);
103
				} else if (projectDirectory.getName().endsWith(".rcp")) {
104
					//plugin_package = plugin_package.substring(0, plugin_package.length()-4);
105
					RCPPluginTest(projectDirectory, plugin_name, plugin_package);
106
				} else {
107
					// ignore project
114 108
				}
115
				System.out.println(" P "+projectDirectory.getName());
116
				for (String s : messages) System.out.println(s);
109

  
110
				if (messages.size() > 0) {
111
					if (nProjectMessage == 0) {
112
						System.out.println();
113
						nProjectMessage++;
114
					}
115
					System.out.println(" P "+projectDirectory.getName());
116
					for (String s : messages) System.out.println(s);
117
				}
118

  
117 119
			}
118
			
119
		}
120 120
		} catch(Exception e) {
121 121
			e.printStackTrace();
122 122
			fail("Internal test error: "+e.getLocalizedMessage());
......
125 125
			fail("Errors during test "+this.getClass().getName());
126 126
		} else System.out.println("OK!");
127 127
	}
128
	
128

  
129 129
	/**
130 130
	 * fetch info before testing individually the projects
131 131
	 */
132 132
	public abstract void gatherData();
133 133

  
134 134

  
135
/**
136
 * 
137
 * @param projectDirectory
138
 * @return find out the main Java src directory of the project
139
 */
135
	/**
136
	 * 
137
	 * @param projectDirectory
138
	 * @return find out the main Java src directory of the project
139
	 */
140 140
	protected static File getJavaSrcDirectory(File projectDirectory) {
141 141
		File javaSrcDirectory = new File(projectDirectory, "src/main/java/");
142 142
		if (!javaSrcDirectory.exists()) javaSrcDirectory = new File(projectDirectory, "src/java");
143 143
		if (!javaSrcDirectory.exists()) javaSrcDirectory = new File(projectDirectory, "src/");
144 144
		return javaSrcDirectory;
145 145
	}
146
	
146

  
147 147
	/**
148 148
	 * test a TBX project
149 149
	 * 
......
153 153
	 * @throws Exception
154 154
	 */
155 155
	public abstract void TBXPluginTest(File projectDirectory, String name, String packagePath) throws Exception;
156
	
156

  
157 157
	/**
158 158
	 * test a RCP project
159 159
	 * @param projectDirectory
tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartsEngine.java (revision 777)
2 2
import java.io.File;
3 3
import java.util.ArrayList;
4 4

  
5
import org.eclipse.core.runtime.IProgressMonitor;
5 6
import org.rosuda.REngine.REXPMismatchException;
6 7
import org.txm.chartsengine.core.ChartsEngine;
7 8
import org.txm.chartsengine.r.core.preferences.RChartsEnginePreferences;
......
207 208
		return null;
208 209
	}
209 210

  
211
	@Override
212
	public boolean getState() {
213
		// TODO Auto-generated method stub
214
		return false;
215
	}
210 216

  
217
	@Override
218
	public boolean initialize() throws Exception {
219
		// TODO Auto-generated method stub
220
		return false;
221
	}
222

  
223
	@Override
224
	public boolean start(IProgressMonitor monitor) throws Exception {
225
		// TODO Auto-generated method stub
226
		return false;
227
	}
228

  
229
	@Override
230
	public boolean stop() throws Exception {
231
		// TODO Auto-generated method stub
232
		return false;
233
	}
234

  
235

  
211 236
}

Formats disponibles : Unified diff