Commit bdfa81e3 authored by Nicolas Sannier's avatar Nicolas Sannier
Browse files

Pushing ARMLET for legislative text conversion

parent 8cbef046
threshold=0.8
annotSetName=Key
outputSetName=
annotTypes=Date;Person;Organization;Location;Percent;Money
<?xml version="1.0"?>
<!-- creole.xml directory file for testpkg resources -->
<!-- $Id: creole.xml 485 2000-09-04 19:20:35Z hamish $ -->
<CREOLE-DIRECTORY>
<!-- creole.xml resource metadata file for test resources -->
<CREOLE>
<RESOURCE>
<NAME>Sheffield Test PR 1</NAME>
<JAR>TestResources.jar</JAR>
<CLASS>testpkg.TestPR1</CLASS>
</RESOURCE>
<RESOURCE>
<NAME>Sheffield Test PR 2</NAME>
<JAR>TestResources.jar</JAR>
<CLASS>testpkg.TestPR2</CLASS>
<AUTOLOAD/>
</RESOURCE>
</CREOLE>
</CREOLE-DIRECTORY>
<?xml version="1.0"?>
<!-- gate.xml -->
<!-- $Id: gate.xml 17653 2014-03-13 19:40:20Z markagreenwood $ -->
<GATE>
</GATE>
rule org.eclipse.** gate.util.compilers.eclipse.@1
rule org.objectweb.asm.** gate.util.asm.@1
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/jayatana-1.2.3.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>GATE-launcher</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<project name="GATE-launcher" basedir="." default="jar" >
<!-- Prevent Ant from warning about includeantruntime not being set -->
<property name="build.sysclasspath" value="ignore" />
<!-- If gate.home is not set from build.properties or the
environment variable GATE_HOME, assume that this
plugin is in GATE Developer's plugin directory -->
<property name="src.dir" location="src" />
<property name="classes.dir" location="classes" />
<property name="lib.dir" location="lib" />
<property name="jar.location" location="../../bin/gateLauncher.jar" />
<!-- The libraries -->
<fileset id="libs" dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<!-- The build CLASSPATH -->
<path id="launcher.build.class.path">
<fileset refid="libs" />
</path>
<!-- create build directory structure -->
<target name="prepare">
<mkdir dir="${classes.dir}" />
</target>
<!-- compile the source -->
<target name="compile" depends="prepare">
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
classpathref="launcher.build.class.path"
debug="true"
debuglevel="lines,source"
encoding="UTF-8"
source="1.6"
target="1.6" />
</target>
<!-- create the JAR file -->
<target name="jar" depends="compile" >
<jar destfile="${jar.location}"
update="false">
<manifest>
<attribute name="Main-Class" value="gate.Launcher" />
</manifest>
<fileset dir="${classes.dir}" />
<archives>
<zips>
<fileset dir="${lib.dir}" includes="*.jar" />
</zips>
</archives>
</jar>
</target>
<!-- remove the generated .class files -->
<target name="clean.classes" >
<delete dir="${classes.dir}" />
</target>
<!-- Clean up - remove .class and .jar files -->
<target name="clean" depends="clean.classes" >
<delete file="${jar.location}" />
</target>
</project>
/*
* Launcher.java
*
* Copyright (c) 1995-2010, The University of Sheffield. See the file
* COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
*
* This file is part of GATE (see http://gate.ac.uk/), and is free
* software, licenced under the GNU Library General Public License,
* Version 2, June 1991 (in the distribution as file licence.html,
* and also available at http://gate.ac.uk/gate/licence.html).
*
* Valentin Tablan, 12 January 2012
*
* $Id: Launcher.java 15880 2012-06-08 14:03:31Z valyt $
*/
package gate;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import org.java.ayatana.ApplicationMenu;
import org.java.ayatana.AyatanaDesktop;
/**
* A simple launcher for GATE. It builds the correct classpath and starts GATE.
*/
public class Launcher {
public static final String GATE_HOME_PROPERTY_NAME = "gate.home";
protected static final Pattern PLACEHOLDER = Pattern.compile("\\$\\{(.*?)\\}");
protected static final FilenameFilter JAR_FILTER = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".jar");
}
};
protected File gateHome;
protected URLClassLoader classLoader;
public void startGate(String[] args) throws ClassNotFoundException,
SecurityException, NoSuchMethodException, IllegalArgumentException,
IllegalAccessException, InvocationTargetException, URISyntaxException,
IOException {
findGateHome();
readSystemProperties();
buildClassPath();
Thread.currentThread().setContextClassLoader(classLoader);
Class.forName("gate.Main", true, classLoader).getDeclaredMethod(
"main", new Class[]{String[].class}).invoke(null, new Object[] {args});
// try to register with Unity
if (AyatanaDesktop.isSupported()){
// the previous call will create a gate.gui.MainFrame in the swing thread
// we queue an action to be called once that completes.
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// get the MainFrame class
try {
JFrame mainFrame = (JFrame) Class.forName("gate.gui.MainFrame",
true, classLoader).getDeclaredMethod("getInstance").invoke(
null, (Object[])null);
if(mainFrame != null){
ApplicationMenu.tryInstall(mainFrame);
}
} catch(Exception e) {
// could not do registration...
// ignore
}
}
});
}
}
protected void findGateHome() throws URISyntaxException {
String gateHomeStr = System.getProperty(GATE_HOME_PROPERTY_NAME);
if(gateHomeStr != null && gateHomeStr.length() > 0) {
gateHome = new File(gateHomeStr);
}
if(gateHome == null || !gateHome.exists()) {
URL gateURL = Launcher.class.getClassLoader().getResource(
"gate/Launcher.class");
if(gateURL.getProtocol().equals("jar")) {
// running from gateLauncher.jar
String gateURLStr = gateURL.getFile();
File gateJarFile = new File(new URI(
gateURLStr.substring(0, gateURLStr.indexOf('!'))));
gateHome = gateJarFile.getParentFile().getParentFile();
} else {
throw new RuntimeException("Could not find gateLauncher.jar! " +
"How has this launcher been started?");
}
}
}
protected void addUrlsForFile(File file, List<URL> urls) throws
MalformedURLException {
if(file != null) {
if("*".equals(file.getName())) {
// Java 6 style "/path/to/directory/*" entry
for(File f : file.getParentFile().listFiles(JAR_FILTER)) {
addUrlsForFile(f, urls);
}
} else {
urls.add(file.toURI().toURL());
}
}
}
protected void buildClassPath() throws MalformedURLException {
List<URL> urls = new LinkedList<URL>();
// start with any externally-specified entries - gate.class.path system
// property wins if it is specified, otherwise GATE_CLASSPATH environment
// variable.
String extraClassPath = System.getProperty("gate.class.path",
System.getenv("GATE_CLASSPATH"));
if(extraClassPath != null) {
String[] extraEntries = extraClassPath.split(
Pattern.quote(File.pathSeparator));
for(String entry : extraEntries) {
if(!"".equals(entry)) addUrlsForFile(new File(entry), urls);
}
}
File binDir = new File(gateHome, "bin");
// gate/bin (for log4j.properties)
addUrlsForFile(binDir, urls);
// bin/gate.jar
addUrlsForFile(new File(binDir, "gate.jar"), urls);
// and lib/*.jar
File libDir = new File(gateHome, "lib");
addUrlsForFile(new File(libDir, "*"), urls);
classLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]),
Launcher.class.getClassLoader());
}
protected void readSystemProperties() throws IOException {
File buildPropertiesFile = new File(gateHome, "build.properties");
if(buildPropertiesFile.canRead()) {
Properties buildProperties = new Properties();
InputStream in = new FileInputStream(buildPropertiesFile);
try {
buildProperties.load(in);
} finally {
in.close();
}
String osPrefix = "os." + System.getProperty("os.name") + ".";
for(String key : buildProperties.stringPropertyNames()) {
if(key.startsWith("run.") &&
System.getProperty(key.substring(4)) == null) {
System.setProperty(key.substring(4), getPropertyValue(key,
new HashSet<String>(), buildProperties, System.getProperties()));
} else if(key.startsWith(osPrefix) &&
System.getProperty(key.substring(osPrefix.length())) == null ) {
System.setProperty(key.substring(osPrefix.length()), getPropertyValue(key,
new HashSet<String>(), buildProperties, System.getProperties()));
}
}
}
String gateHomeStr = System.getProperty(GATE_HOME_PROPERTY_NAME);
if(gateHomeStr != null && gateHomeStr.length() > 0) {
gateHome = new File(gateHomeStr);
}
}
protected String getPropertyValue(String key, Set<String> seen, Properties... context) {
String value = null;
for(Properties p : context) {
value = p.getProperty(key);
if(value != null) break;
}
if(value != null) {
Matcher m = PLACEHOLDER.matcher(value);
if(m.find()) {
m.reset();
StringBuffer newValue = new StringBuffer();
while(m.find()) {
String varName = m.group(1);
if(seen.contains(varName)) {
throw new RuntimeException("Property " + varName +
" is circularly defined.");
}
seen.add(varName);
try {
String varValue = getPropertyValue(varName, seen, context);
if(varValue == null) {
varValue = m.group();
}
m.appendReplacement(newValue, Matcher.quoteReplacement(varValue));
} finally {
seen.remove(varName);
}
}
m.appendTail(newValue);
value = newValue.toString();
}
}
return value;
}
/**
* @param args
*/
public static void main(String[] args) {
Launcher launcher = new Launcher();
try {
launcher.startGate(args);
} catch(Exception e) {
e.printStackTrace();
}
}
}
#!/bin/sh
# list.sh - make a pretty list of the gate source, missing class files etc.
# $Id: list.sh 6815 2005-08-17 11:01:05Z hcunningham $
clear
cd ../../
find gate2 -print | \
grep -v '^gate2/lib/' | sed 's,gate2/lib,gate2/lib/...,' | \
grep -v '^gate2/doc/javadoc/' | \
sed 's,gate2/doc/javadoc,gate2/doc/javadoc/...,' | \
grep -v '^gate2/misc/' | sed 's,gate2/misc,gate2/misc/...,' | \
grep -v '^gate2/classes/' | sed 's,gate2/classes,gate2/classes/...,' | \
grep -v '^gate2/bin/images/' | \
grep -v 'Default.vfPackage' | \
grep -v 'CVS' | \
sed 's,gate2/bin/images,gate2/bin/images/...,' | \
sort
/*
Dummy.java
Hamish Cunningham, 13/06/00
$Id: Dummy.java 385 2000-06-23 16:22:30Z hamish $
*/
package testpkg;
import java.io.*;
/** A dummy class, used for testing reloading of classes in
* TestJDK.
*/
public class Dummy
{
public static int i = 0;
static {
// System.out.println("initialising dummy class, i = " + i++);
}
} // class Dummy
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment