Commit e7f382a9 authored by Christian Reuschling's avatar Christian Reuschling
Browse files

new default dynaq executable at toplevel | bugfix: PrefixQuery can now be...

new default dynaq executable at toplevel | bugfix: PrefixQuery can now be serialized again | release 2.7 version
parent 57a1dfbd
#!/bin/bash
bin/dynaq.sh
......@@ -5,7 +5,7 @@
<groupId>dfki.sds.dynaq</groupId>
<artifactId>dynaq</artifactId>
<packaging>jar</packaging>
<version>2.7-SNAPSHOT</version>
<version>2.7</version>
<name>dynaq</name>
<url>http://dynaq.opendfki.de</url>
......
......@@ -11,6 +11,7 @@
<includeBaseDirectory />
<fileSets>
<fileSet>
<directory>${project.build.directory}/assembleDir/</directory>
<outputDirectory>/</outputDirectory>
......@@ -27,6 +28,16 @@
</includes>
<fileMode>700</fileMode>
</fileSet>
<fileSet>
<directory>.</directory>
<outputDirectory>.</outputDirectory>
<includes>
<include>*.sh</include>
</includes>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
......@@ -3,9 +3,12 @@ package org.dynaq;
import com.cedarsoftware.util.io.JsonReader;
import de.dfki.inquisitor.exceptions.ExceptionUtils;
import de.dfki.inquisitor.file.FileUtilz;
import de.dfki.inquisitor.resources.ResourceUtilz;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.PrefixQuery;
import org.apache.lucene.store.Lock;
import org.apache.lucene.store.NativeFSLockFactory;
import org.kafkaRCP.core.KafkaRCPConstants;
......@@ -29,18 +32,48 @@ public class DynaQ
{
protected static Lock m_dynaqRunsLock;
static class DynaQShutdownHook extends Thread
{
@Override
public void run()
{
try
{
// einmal die supi GC, daß auch noch die pending finalize() Teile ausgefürt werden :)
System.gc();
System.gc();
// wir machen den Lock auf die Applikation zu. Das ist zwar technisch nicht nötig (der lock funktoniert nicht über die schiere
// Existenz des File,
// sieht aber schöner aus, wenn das File auch wieder verschwindet)
m_dynaqRunsLock.close();
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
}
}
// TODO bei Programmstart überprüfen, ob die indices auch da sind, und gescheite Fehlermeldungen ausgeben
protected static Lock m_dynaqRunsLock;
static
{
JsonReader.assignInstantiator(PrefixQuery.class, (JsonReader.ClassFactory) c -> new PrefixQuery(new Term("DUMMYfeld", "DUMMYwaldWiese")));
}
/**
* Determines whether this DynaQ application (which means the DynaQ installed in this specific directory) is up and running or not
*
*
* @return true: the application is already started, false otherwise
*
* @throws IOException
*/
public static boolean isUpAndRunning() throws IOException
......@@ -48,7 +81,8 @@ public class DynaQ
NativeFSLockFactory lockFactory = new NativeFSLockFactory(KafkaRCPConstants.addKafkaBaseDir2RelativePath("."));
lockFactory.setLockPrefix("dynaq");
if(m_dynaqRunsLock == null) m_dynaqRunsLock = lockFactory.makeLock("running.lock");
if(m_dynaqRunsLock == null)
m_dynaqRunsLock = lockFactory.makeLock("running.lock");
if(!m_dynaqRunsLock.obtain())
return true;
......@@ -65,7 +99,8 @@ public class DynaQ
// wir checken als erstes ab, ob schon ein DynaQ läuft - wenn ja, dann brechen wir gleich mal ab - nicht ohne eine Meldung auszugeben
NativeFSLockFactory lockFactory = new NativeFSLockFactory(KafkaRCPConstants.addKafkaBaseDir2RelativePath("."));
lockFactory.setLockPrefix("dynaq");
if(m_dynaqRunsLock == null) m_dynaqRunsLock = lockFactory.makeLock("running.lock");
if(m_dynaqRunsLock == null)
m_dynaqRunsLock = lockFactory.makeLock("running.lock");
if(!m_dynaqRunsLock.obtain())
{
return false;
......@@ -83,6 +118,7 @@ public class DynaQ
public static void main(String[] args) throws Throwable
{
// wir kippen initial auch noch die eigentlichen configs aus dem jar in das FileSystem ab, wenn sie nicht schon da sind
ResourceUtilz.copyResources2Disk("/dynaqWorkingDirContent", KafkaRCPConstants.addKafkaBaseDir2RelativePath("."), false);
......@@ -105,8 +141,8 @@ public class DynaQ
bLogConfig = false;
else if(strArg.equals("-h") || strArg.equals("--help"))
{
System.out.println("-noLoggingConfig => no logging properties will be loaded. DynaQ will start with Java defaults.\n"
+ "-h or --help => displays this message.");
System.out.println(
"-noLoggingConfig => no logging properties will be loaded. DynaQ will start with Java defaults.\n" + "-h or --help => displays this message.");
return;
}
......@@ -117,7 +153,8 @@ public class DynaQ
if(bLogConfig)
{
File fLogProps = new File(KafkaRCPConstants.addKafkaBaseDir2RelativePath("config/logging.properties"));
if(!fLogProps.exists()) FileUtilz.copyFile(new File(fLogProps.getAbsolutePath() + ".reference"), fLogProps);
if(!fLogProps.exists())
FileUtilz.copyFile(new File(fLogProps.getAbsolutePath() + ".reference"), fLogProps);
LogManager.getLogManager().readConfiguration(new FileInputStream(fLogProps));
System.setProperty("java.util.logging.config.file", fLogProps.getAbsolutePath());
}
......@@ -135,8 +172,8 @@ public class DynaQ
Logger.getLogger(DynaQ.class.getName()).info("Java2D OpenGL acceleration disabled. Windows 2000 don't support this.");
}
else
Logger.getLogger(DynaQ.class.getName()).info(
"Java2D OpenGL acceleration enabled. Try to start DynaQ with '-Dsun.java2d.opengl=false' if you have GUI trouble.");
Logger.getLogger(DynaQ.class.getName())
.info("Java2D OpenGL acceleration enabled. Try to start DynaQ with '-Dsun.java2d.opengl=false' if you have GUI trouble.");
}
// else
// Logger.getLogger(DynaQ.class.getName()).info(
......@@ -167,35 +204,4 @@ public class DynaQ
}
static class DynaQShutdownHook extends Thread
{
@Override
public void run()
{
try
{
// einmal die supi GC, daß auch noch die pending finalize() Teile ausgefürt werden :)
System.gc();
System.gc();
// wir machen den Lock auf die Applikation zu. Das ist zwar technisch nicht nötig (der lock funktoniert nicht über die schiere
// Existenz des File,
// sieht aber schöner aus, wenn das File auch wieder verschwindet)
m_dynaqRunsLock.close();
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
}
}
}
############################################################
# Default Logging Configuration File
#
# You can use a different file by specifying a filename with the
# java.util.logging.config.file system property. For example java
# -Djava.util.logging.config.file=myfile
############################################################
############################################################
# Global properties
############################################################
# "handlers" specifies a comma separated list of log Handler
# classes. These handlers will be installed during VM startup.
# Note that these classes must be on the system classpath.
#handlers= java.util.logging.ConsoleHandler
handlers= org.dynaq.util.logging.DynaQLogFileHandler, java.util.logging.ConsoleHandler
handlers= java.util.logging.ConsoleHandler
#handlers= org.dynaq.util.logging.DynaQLogFileHandler, java.util.logging.ConsoleHandler
# Default global logging level.
# This specifies which kinds of events are logged across all loggers. For any
# given facility this global level can be overriden by a facility specific level.
# Note that the ConsoleHandler also has a separate level setting to limit messages
# printed to the console.
.level= INFO
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
# Limit the message that are printed on the console to FINEST and above (:-)
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = de.dfki.inquisitor.logging.inquisitorLoggingFormatter
# Additionally to the standard special components of a pattern defined for java.util.logging.FileHandler like
# %u or %t the special component %kafkaBaseDirectory may be used to refer to the configured Kafka base directory
# Additionally to the standard special components of a pattern defined for java.util.logging.FileHandler like
# %u or %t the special component %kafkaBaseDirectory may be used to refer to the configured Kafka base directory
java.util.logging.FileHandler.level = FINE
java.util.logging.FileHandler.pattern = %kafkaBaseDirectory/loggingDynaQ.log
### no limit for number of bytes to be written
......@@ -44,13 +21,9 @@ java.util.logging.FileHandler.limit = 0
java.util.logging.FileHandler.count = 1
org.dynaq.util.logging.DynaQLogFileHandler.formatter = de.dfki.inquisitor.logging.inquisitorLoggingFormatter
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
# OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL
#org.level = FINE
org.dynaq.level = INFO
org.dynaq.util.images.level = INFO
......@@ -59,6 +32,7 @@ org.dynaq.index.level = INFO
#org.dynaq.util.lucene.level = FINE
de.dfki.inquisitor.level = INFO
de.dfki.xmlrpc.classproxy.level = INFO
org.apache.pdfbox.pdmodel.level = OFF
......
......@@ -2,11 +2,15 @@ package org.dynaq;
import com.cedarsoftware.util.io.JsonReader;
import com.cedarsoftware.util.io.JsonWriter;
import de.dfki.inquisitor.collections.CollectionUtilz;
import de.dfki.inquisitor.collections.TwoValuesBox;
import de.dfki.inquisitor.file.FileUtilz;
import de.dfki.inquisitor.ui.color.ColorFactory;
import de.dfki.inquisitor.ui.tablelayout.TableLayoutUtil;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.PrefixQuery;
import org.carrot2.clustering.Cluster;
import org.carrot2.clustering.Document;
import org.carrot2.clustering.lingo.LingoClusteringAlgorithm;
......@@ -31,6 +35,7 @@ import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileInputStream;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
......@@ -460,6 +465,30 @@ public class FeldWaldWiese
public static void main(String[] args) throws Exception
{
PrefixQuery prefixQuery = new PrefixQuery(new Term("feld", "waldWiese"));
String strJson = JsonWriter.objectToJson(prefixQuery);
JsonReader jr = new JsonReader(strJson, null);
JsonReader.assignInstantiator(PrefixQuery.class, new JsonReader.ClassFactory() {
@Override
public Object newInstance(Class c)
{
return new PrefixQuery(new Term("DUMMYfeld", "DUMMYwaldWiese"));
}
});
PrefixQuery prefixQuery2 = (PrefixQuery) jr.readObject();
jr.close();
System.out.println(prefixQuery2.getPrefix());
System.out.println(prefixQuery2.getField());
if(true)
return;
JFrame frame = new JFrame();
frame.setContentPane(new Pdf2CsvManualJPanel());
......
Supports Markdown
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