Skip to content

Commit

Permalink
Windows native executable wrapping the Jar-archive added.
Browse files Browse the repository at this point in the history
  • Loading branch information
T-F-S committed Jul 11, 2014
1 parent c5654b5 commit a98b074
Show file tree
Hide file tree
Showing 9 changed files with 218 additions and 58 deletions.
4 changes: 2 additions & 2 deletions build.number
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Wed Jul 09 12:24:35 CEST 2014
build.number=52
#Fri Jul 11 16:28:53 CEST 2014
build.number=56
21 changes: 18 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
CSV-Sorter ANT build
</description>

<property name="version.number" value="0.92-beta"/>
<property name="version.date" value="2014/07/09"/>
<property name="version.number" value="0.93 beta"/>
<property name="version.date" value="2014/07/11"/>

<property name="root" location="."/>
<property name="src" location="${root}/src"/>
<property name="build" location="${root}/bin_ant"/>
<property name="dist" location="${root}/dist"/>
<property name="archive" location="${root}/archive"/>
<property name="testbed" location="${root}/testbed"/>
<property name="launcher" location="${root}/launcher"/>

<property name="package" value="tfs/csvsorter"/>
<property name="jar.name" value="csvsorter"/>
Expand All @@ -23,6 +24,11 @@
<property name="docdir" location="${root}/doc"/>
<property name="jobname" value="csvsorter"/>

<property name="launch4j.dir" location="c:\Program Files\Launch4j" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />


<!-- /////////////////////////////////////////////////////////////////////////// -->
<target name="init">
Expand Down Expand Up @@ -152,13 +158,22 @@
</target>


<!-- /////////////////////////////////////////////////////////////////////////// -->
<target name="makeLauncher" depends="makeJar" description="Create Windows Launcher" >
<copy file="${launcher}/launch4j.xml" todir="${build}"/>
<copy file="${launcher}/csvsorter.ico" todir="${build}"/>
<launch4j configFile="${build}/launch4j.xml"/>
</target>



<!-- /////////////////////////////////////////////////////////////////////////// -->
<target name="distribution" depends="clean,makeJar,documentation" description="generate the distribution" >
<target name="distribution" depends="clean,makeJar,makeLauncher,documentation" description="generate the distribution" >
<mkdir dir="${dist}" />
<copy todir="${dist}">
<fileset dir="${build}">
<include name="${jar.name}.jar"/>
<include name="${jar.name}.exe"/>
</fileset>
</copy>
<copy todir="${dist}">
Expand Down
67 changes: 59 additions & 8 deletions doc/csvsorter.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
% \LaTeX-Main\
%% The csvsorter program - version 0.92-beta (2014/07/09)
%% The csvsorter program - version 0.93 beta (2014/07/11)
%% csvsorter.tex: Manual
%%
%% Copyright (c) 2014, Prof. Dr. Dr. Thomas F. Sturm
Expand Down Expand Up @@ -70,8 +70,8 @@
\usepackage[many,listings,minted]{tcolorbox}
\usetikzlibrary{arrows.meta}

\def\version{0.92-beta}%
\def\datum{2014/07/09}%
\def\version{0.93 beta}%
\def\datum{2014/07/11}%
\def\docdatum{\datum}

\hypersetup{
Expand Down Expand Up @@ -296,7 +296,7 @@ \section{License}

\clearpage
\section{Installation}
\subsection{Basic Installation}

\csvsorter\ is written in Java and needs to have a
Java virtual machine (version 1.6 or higher) installed.
With some luck, you already have Java installed on your system.
Expand All @@ -307,6 +307,13 @@ \subsection{Basic Installation}
displays some Java version information, you have
Java installed. Otherwise, you need to install a Java Runtime Environment to proceed.

\csvsorter\ is a portable program which needs not necessarily be installed in
some way. See Subsection~\ref{basiccommon} and Subsection~\ref{basicwindows}
how to execute \csvsorter. Further installation steps are found in Subsection~\ref{furtherinstallcommon}
and in Subsection~\ref{furtherinstallwindows}.

\subsection{Basic Execution (platform-independent)}\label{basiccommon}

The \csvsorter\ is an executable Jar-archive named \comname{csvsorter.jar}.
You can build \comname{csvsorter.jar} from the sources, but this is usually
not necessary.
Expand All @@ -323,7 +330,26 @@ \subsection{Basic Installation}
If you get some Java errors, your installed virtual machine is probably too
old and you have to update it to use \csvsorter\ .

\subsection{Further Installation}

\subsection{Basic Execution (Windows)}\label{basicwindows}

The \csvsorter\ is wrapped into a Windows native executable named \comname{csvsorter.exe}.
It does not provide a GUI and therefore cannot be started by double-clicking.
Instead, open a command console with \comname{cmd.exe}, change with it
to the directory where you saved \comname{csvsorter.exe}.
Execute the program on the command-line in this directory:\\
\command*{csvsorter.exe}

You should see something like\\
\comname{This is CSV-Sorter} followed by\\
\comname{Configuration file is missing.} and further text.
This means that you are ready to use \csvsorter\
in the current directory.
If you get some Java errors, your installed virtual machine is probably too
old and you have to update it to use \csvsorter\ .

\clearpage
\subsection{Further Installation (somewhat platform-independent)}\label{furtherinstallcommon}
The further steps are optional and provide an easier use for \csvsorter\ .

Instead of calling \command*{java -jar csvsorter.jar §options§}, you are
Expand All @@ -343,12 +369,29 @@ \subsection{Further Installation}
Put this \comname{csvsorter.cmd} to a directory which is part of your
system path. If you do not know where to put this file, create a directory
\comname{c:\bat}, put the file into it, and \emph{add} the new directory to
your path variable. A similar script file is recommended for Linux users.
your path variable.

A similar script file is recommended for Linux users:

\begin{xml}[title={csvsorter},minted language=bash]
#!/bin/bash
java -jar "/SOME PATH STRING/csvsorter.jar" $@
# further: chmod u+x csvsorter
\end{xml}
\catcode`\Q=14 Q$
\catcode`\Q=11

After these steps, \csvsorter\ is accessible system-wide by\\
\command*{csvsorter §options§}


\subsection{Further Installation (Windows)}\label{furtherinstallwindows}
Copy the \comname{csvsorter.exe} into a directory which is part of your
system path. If you intend to use it with the |csvsimple| \LaTeX\ package,
you could put it e.\,g.\ into the directory of the
\LaTeX\ binaries.


\clearpage
\section{Usage}
Depending on the installation done in the last section, \csvsorter\
Expand Down Expand Up @@ -853,7 +896,15 @@ \subsection{Hierarchical brackets}
\clearpage
\section{Version History}
\versionbox[before=\par]{Version \version\ (\datum)}
%\versionbox[before=\par]{Version \version\ (\datum)}
\versionbox[before=\par]{Version 0.93 beta (2014/07/11)}
\begin{changelist}
\item[new] Windows native executable wrapping the Jar-archive added.
\item[new] More log messages added.
\end{changelist}
\versionbox{Version 0.92 beta (2014/07/09)}
\begin{changelist}
\item[fixed] Data loss, if input and output file are the same, corrected.
\item[fixed] Descending string sorting corrected.
Expand All @@ -865,7 +916,7 @@ \section{Version History}
\item[new] Data type 'long' added.
\end{changelist}
\versionbox[before=\par]{Version 0.91 beta (2014/07/05)}
\versionbox{Version 0.91 beta (2014/07/05)}
\begin{changelist}
\item[changed] Hierarchical bracket algorithm improved.
\item[changed] Speed optimization for brackets (about 50 percent).
Expand Down
28 changes: 18 additions & 10 deletions src/tfs/csvsorter/CSVSorter.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public class CSVSorter

static
{
VERSION = "0.92-beta";
DATE = "2014/07/09";
BUILD = 51;
VERSION = "0.93 beta";
DATE = "2014/07/11";
BUILD = 55;
PROGNAME = "CSV-Sorter";
}

Expand Down Expand Up @@ -187,7 +187,7 @@ private void processCSV(Configuration configuration, PrintWriter log) throws Exc
{
for (int i=0;i<columncount;i++)
{
log.println("Column "+(i+1)+": >"+headparts[i]+"<");
log.println(" Column "+(i+1)+": \""+headparts[i]+"\"");
}
// Names to columns
for (int i=0; i<columncount; i++)
Expand All @@ -196,13 +196,16 @@ private void processCSV(Configuration configuration, PrintWriter log) throws Exc
}
}

ColumnComparator[] ccArray = configuration.getCcArray();
if (configuration.isSorting())
{
for (ColumnComparator cc : configuration.getCcArray())
log.println("Sorting rules:");
for (int i=0; i<ccArray.length; i++)
{
try
{
cc.config(namespalte,columncount);
ccArray[i].config(namespalte,columncount);
log.println(" "+(i+1)+". "+ccArray[i].getDescription());
}
catch (Exception ex)
{
Expand Down Expand Up @@ -240,9 +243,10 @@ private void processCSV(Configuration configuration, PrintWriter log) throws Exc
}
}

log.println("------");
log.println("Processing the CSV file...");
// Process input file
ArrayList<LineContainer> content = new ArrayList<LineContainer>();
ColumnComparator[] ccArray = configuration.getCcArray();

long ignoredLines = 0;
String line = reader.readLine();
Expand Down Expand Up @@ -344,17 +348,21 @@ private PrintWriter createOutputWriter(Configuration configuration, PrintWriter

public static void printUsageAndExit()
{
System.out.println("");
System.out.println("Usage of CSV Sorter:");
System.out.println("java -jar CSVsorter.jar OPTIONS");
System.out.println("java -jar csvsorter.jar OPTIONS");
System.out.println(" where OPTIONS are the following:");
System.out.println(" -c configuration xml file (mandatory)");
System.out.println(" -l logfile");
System.out.println(" -i input csv file");
System.out.println(" -o output csv file");
System.out.println(" -x input=output csv file");
System.out.println("");
System.out.println("Example:");
System.out.println("java -jar CSVsorter.jar -c myconf.xml -i example.csv -o examplesorted.csv");
System.out.println("Example (all platforms):");
System.out.println("java -jar csvsorter.jar -c myconf.xml -i example.csv -o examplesorted.csv");
System.out.println("");
System.out.println("Example (Windows):");
System.out.println("csvsorter.exe -c myconf.xml -i example.csv -o examplesorted.csv");
System.out.println("");
System.out.println("Note: The configuration file may contain the rest of the options.");
System.out.println(" Command line options override configuration file settings.");
Expand Down
1 change: 1 addition & 0 deletions src/tfs/csvsorter/ColumnComparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ interface ColumnComparator

public void config(HashMap<String,Integer> nameToColumn, int maxNumber) throws Exception;

public String getDescription();

}
4 changes: 2 additions & 2 deletions src/tfs/csvsorter/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ else if (elColumn.getNodeName().equals("sum"))
private ColumnComparator makeColumnComparator(Element elColumn) throws Exception
{
NumberName numberName = new NumberName(elColumn);
String type = elColumn.getAttribute("type");
String type = elColumn.getAttribute("type").toLowerCase();
boolean ascending = !(elColumn.getAttribute("order").toLowerCase().equals("descending"));
String defaultString = elColumn.getAttribute("default");

Expand Down Expand Up @@ -327,7 +327,7 @@ else if (type.equals("string") || type.equals(""))

private ColumnComparator makeSumColumnComparator(Element elSum) throws Exception
{
String type = elSum.getAttribute("type");
String type = elSum.getAttribute("type").toLowerCase();
boolean ascending = !(elSum.getAttribute("order").toLowerCase().equals("descending"));
String defaultString = elSum.getAttribute("default");

Expand Down
Loading

0 comments on commit a98b074

Please sign in to comment.