Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

merged current rc1/master into jetty branch to allow further development with latest version ServerSideIncludes and servlet return values need further work (for working jetty integration) - TODO: added nasty quickfix to allow SSI - needs further work - TODO: YaCy servlet return values/parameters are not handled

regeraafef72a8aa2
diff --cc .classpath
index 730b621c5,1f79155a6..25536c534
--- a/.classpath
+++ b/.classpath
@@@ -1,80 -1,83 +1,86 @@@
--<?xml version="1.0" encoding="UTF-8"?>
--<classpath>
- <classpathentry excluding="api/|env/|processing/domaingraph/applet/|yacy/|api/bookmarks/|api/ymarks/|api/bookmarks/posts/|api/bookmarks/tags/|api/bookmarks/xbel/" kind="src" path="htroot"/>
- <classpathentry kind="src" path="source"/>
- <classpathentry excluding="api/|env/|processing/domaingraph/applet/|yacy/|api/bookmarks/|api/ymarks/|api/bookmarks/posts/|api/bookmarks/tags/|api/bookmarks/xbel/|solr/|gsa/|solr/collection1/" kind="src" path="htroot"/>
-- <classpathentry excluding="bookmarks/|ymarks/|bookmarks/posts/|bookmarks/tags/|bookmarks/xbel/" kind="src" path="htroot/api"/>
- <classpathentry kind="src" path="htroot/env"/>
- <classpathentry kind="src" path="htroot/yacy"/>
-- <classpathentry excluding="posts/|tags/|xbel/" kind="src" path="htroot/api/bookmarks"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
- <classpathentry kind="src" path="htroot/api/ymarks"/>
- <classpathentry kind="src" path="htroot/api/bookmarks/posts"/>
- <classpathentry kind="src" path="htroot/api/bookmarks/tags"/>
- <classpathentry kind="src" path="htroot/api/bookmarks/xbel"/>
- <classpathentry excluding="collection1/" kind="src" path="htroot/solr"/>
- <classpathentry kind="src" path="htroot/gsa"/>
-- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
-- <classpathentry kind="lib" path="lib/J7Zip-modified.jar"/>
- <classpathentry kind="lib" path="lib/webcat-0.1-swf.jar"/>
-- <classpathentry kind="lib" path="lib/activation.jar"/>
- <classpathentry kind="lib" path="lib/apache-mime4j-0.6.jar"/>
- <classpathentry kind="lib" path="lib/apache-solr-core-3.6.0.jar" sourcepath="/Volumes/Raptor/Data/workspace1/apache-solr-3.6.0/src/java"/>
- <classpathentry kind="lib" path="lib/apache-solr-solrj-3.6.0.jar" sourcepath="/Volumes/Raptor/Data/workspace1/apache-solr-3.6.0/src/java"/>
- <classpathentry kind="lib" path="lib/arq-2.8.7.jar"/>
- <classpathentry kind="lib" path="lib/commons-jxpath-1.3.jar"/>
- <classpathentry kind="lib" path="lib/poi-3.6-20091214.jar"/>
- <classpathentry kind="lib" path="lib/poi-scratchpad-3.6-20091214.jar"/>
-- <classpathentry kind="lib" path="lib/bcmail-jdk15-145.jar"/>
-- <classpathentry kind="lib" path="lib/bcprov-jdk15-145.jar"/>
- <classpathentry kind="lib" path="lib/commons-codec-1.6.jar"/>
- <classpathentry kind="lib" path="lib/commons-compress-1.4.1.jar"/>
- <classpathentry kind="lib" path="lib/commons-fileupload-1.2.2.jar" sourcepath="/Users/admin/.m2/repository/commons-fileupload/commons-fileupload/1.2.2/commons-fileupload-1.2.2-sources.jar"/>
- <classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
- <classpathentry kind="lib" path="lib/commons-io-2.1.jar"/>
- <classpathentry kind="lib" path="lib/commons-jxpath-1.3.jar"/>
- <classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/>
- <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
- <classpathentry kind="lib" path="lib/fontbox-1.7.0.jar"/>
- <classpathentry kind="lib" path="lib/geronimo-stax-api_1.0_spec-1.0.1.jar"/>
- <classpathentry kind="lib" path="lib/guava-r05.jar"/>
- <classpathentry kind="lib" path="lib/htmllexer.jar"/>
- <classpathentry kind="lib" path="lib/htmlparser.jar"/>
- <classpathentry kind="lib" path="lib/httpclient-4.2.jar"/>
- <classpathentry kind="lib" path="lib/httpcore-4.2.jar"/>
- <classpathentry kind="lib" path="lib/httpmime-4.2.jar"/>
- <classpathentry kind="lib" path="lib/icu4j-core.jar"/>
- <classpathentry kind="lib" path="lib/iri-0.8.jar"/>
- <classpathentry kind="lib" path="lib/jakarta-oro-2.0.8.jar"/>
- <classpathentry kind="lib" path="lib/jcifs-1.3.15.jar"/>
- <classpathentry kind="lib" path="lib/jcl-over-slf4j-1.6.1.jar"/>
- <classpathentry kind="lib" path="lib/jempbox-1.7.0.jar"/>
- <classpathentry kind="lib" path="lib/jena-2.6.4.jar" sourcepath="/Users/admin/.m2/repository/com/hp/hpl/jena/jena/2.6.4/jena-2.6.4-sources.jar"/>
- <classpathentry kind="lib" path="lib/jetty-6.1.26-patched-JETTY-1340.jar"/>
- <classpathentry kind="lib" path="lib/jetty-continuation-7.3.0.v20110203.jar"/>
- <classpathentry kind="lib" path="lib/jetty-http-7.3.0.v20110203.jar"/>
- <classpathentry kind="lib" path="lib/jetty-io-7.3.0.v20110203.jar"/>
- <classpathentry kind="lib" path="lib/jetty-security-7.3.0.v20110203.jar"/>
- <classpathentry kind="lib" path="lib/jetty-server-7.3.0.v20110203.jar"/>
- <classpathentry kind="lib" path="lib/jetty-servlet-7.3.0.v20110203.jar"/>
- <classpathentry kind="lib" path="lib/jetty-servlets-7.3.0.v20110203.jar"/>
- <classpathentry kind="lib" path="lib/jetty-util-6.1.26-patched-JETTY-1340.jar"/>
- <classpathentry kind="lib" path="lib/jetty-util-7.3.0.v20110203.jar"/>
-- <classpathentry kind="lib" path="lib/jsch-0.1.42.jar"/>
- <classpathentry kind="lib" path="lib/json-simple-1.1.jar"/>
- <classpathentry kind="lib" path="lib/log4j-1.2.16.jar"/>
- <classpathentry kind="lib" path="lib/log4j-over-slf4j-1.6.1.jar"/>
- <classpathentry kind="lib" path="lib/lucene-analyzers-3.6.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-core-3.6.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-highlighter-3.6.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-phonetic-3.6.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-spatial-3.6.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-spellchecker-3.6.0.jar"/>
- <classpathentry kind="lib" path="lib/metadata-extractor-2.4.0-beta-1.jar"/>
- <classpathentry kind="lib" path="lib/jakarta-oro-2.0.8.jar"/>
-- <classpathentry kind="lib" path="lib/mysql-connector-java-5.1.12-bin.jar"/>
- <classpathentry kind="lib" path="lib/pdfbox-1.7.0.jar"/>
- <classpathentry kind="lib" path="lib/poi-3.6-20091214.jar" sourcepath="/Users/admin/.m2/repository/org/apache/poi/poi/3.6/poi-3.6-sources.jar"/>
- <classpathentry kind="lib" path="lib/poi-scratchpad-3.6-20091214.jar"/>
- <classpathentry kind="lib" path="lib/sax-2.0.1.jar"/>
- <classpathentry kind="lib" path="lib/servlet-api-2.5-20081211.jar"/>
- <classpathentry kind="lib" path="lib/slf4j-api-1.6.1.jar"/>
- <classpathentry kind="lib" path="lib/slf4j-jdk14-1.6.1.jar"/>
- <classpathentry kind="lib" path="lib/webcat-0.1-swf.jar"/>
- <classpathentry kind="lib" path="lib/wstx-asl-3.2.7.jar"/>
- <classpathentry kind="lib" path="lib/apache-mime4j-0.6.jar"/>
- <classpathentry kind="lib" path="lib/commons-fileupload-1.2.2.jar"/>
- <classpathentry kind="lib" path="lib/json-simple-1.1.jar"/>
-- <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
-- <classpathentry kind="lib" path="lib/xml-apis.jar"/>
- <classpathentry kind="lib" path="lib/geronimo-stax-api_1.0_spec-1.0.1.jar"/>
- <classpathentry kind="lib" path="lib/commons-io-2.1.jar"/>
- <classpathentry kind="lib" path="lib/commons-compress-1.4.1.jar"/>
- <classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/>
- <classpathentry kind="lib" path="lib/servlet-api-2.5-20081211.jar"/>
- <classpathentry kind="lib" path="lib/jaudiotagger-2.0.4-20111207.115108-15.jar"/>
- <classpathentry kind="lib" path="lib/commons-codec-1.7.jar"/>
- <classpathentry kind="lib" path="lib/spatial4j-0.3.jar"/>
- <classpathentry kind="lib" path="lib/jcl-over-slf4j-1.7.2.jar"/>
- <classpathentry kind="lib" path="lib/slf4j-api-1.7.2.jar"/>
- <classpathentry kind="lib" path="lib/zookeeper-3.4.5.jar"/>
- <classpathentry kind="lib" path="lib/guava-13.0.1.jar"/>
- <classpathentry kind="lib" path="lib/wstx-asl-3.2.9.jar"/>
- <classpathentry kind="lib" path="lib/slf4j-jdk14-1.7.2.jar"/>
- <classpathentry kind="lib" path="lib/log4j-over-slf4j-1.7.2.jar"/>
- <classpathentry kind="lib" path="lib/httpclient-4.2.5.jar"/>
- <classpathentry kind="lib" path="lib/httpcore-4.2.4.jar"/>
- <classpathentry kind="lib" path="lib/httpmime-4.2.5.jar"/>
- <classpathentry kind="lib" path="lib/noggit-0.5.jar"/>
- <classpathentry kind="lib" path="lib/metadata-extractor-2.6.2.jar"/>
- <classpathentry kind="lib" path="lib/lucene-analyzers-common-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-analyzers-phonetic-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-classification-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-codecs-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-core-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-facet-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-grouping-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-highlighter-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-join-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-memory-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-misc-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-queries-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-queryparser-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-spatial-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/lucene-suggest-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/solr-core-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/solr-solrj-4.4.0.jar"/>
- <classpathentry kind="lib" path="lib/jcifs-1.3.17.jar"/>
- <classpathentry kind="lib" path="lib/fontbox-1.8.2.jar"/>
- <classpathentry kind="lib" path="lib/jempbox-1.8.2.jar"/>
- <classpathentry kind="lib" path="lib/pdfbox-1.8.2.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
- <classpathentry kind="lib" path="lib/icu4j-core.jar"/>
- <classpathentry kind="lib" path="lib/htmllexer.jar"/>
- <classpathentry kind="lib" path="lib/jena-2.6.4.jar"/>
- <classpathentry kind="lib" path="lib/sax-2.0.1.jar"/>
- <classpathentry kind="lib" path="lib/arq-2.8.7.jar"/>
- <classpathentry kind="lib" path="lib/iri-0.8.jar"/>
- <classpathentry kind="lib" path="lib/jsoup-1.6.3.jar"/>
-- <classpathentry kind="output" path="gen"/>
- <classpathentry kind="src" path="htroot/api/bookmarks/posts"/>
- <classpathentry kind="src" path="htroot/api/bookmarks/tags"/>
- <classpathentry kind="src" path="htroot/api/bookmarks/xbel"/>
- <classpathentry kind="src" path="htroot/api/ymarks"/>
- <classpathentry kind="src" path="htroot/env"/>
- <classpathentry kind="src" path="htroot/yacy"/>
- <classpathentry kind="src" path="source"/>
--</classpath>
++<?xml version="1.0" encoding="UTF-8"?>
++<classpath>
++ <classpathentry kind="src" path="source"/>
++ <classpathentry excluding="api/|env/|processing/domaingraph/applet/|yacy/|api/bookmarks/|api/ymarks/|api/bookmarks/posts/|api/bookmarks/tags/|api/bookmarks/xbel/|solr/|gsa/|solr/collection1/" kind="src" path="htroot"/>
++ <classpathentry excluding="bookmarks/|ymarks/|bookmarks/posts/|bookmarks/tags/|bookmarks/xbel/" kind="src" path="htroot/api"/>
++ <classpathentry excluding="posts/|tags/|xbel/" kind="src" path="htroot/api/bookmarks"/>
++ <classpathentry kind="src" path="htroot/api/ymarks"/>
++ <classpathentry kind="src" path="htroot/api/bookmarks/posts"/>
++ <classpathentry kind="src" path="htroot/api/bookmarks/tags"/>
++ <classpathentry kind="src" path="htroot/api/bookmarks/xbel"/>
++ <classpathentry excluding="collection1/" kind="src" path="htroot/solr"/>
++ <classpathentry kind="src" path="htroot/gsa"/>
++ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
++ <classpathentry kind="lib" path="lib/J7Zip-modified.jar"/>
++ <classpathentry kind="lib" path="lib/activation.jar"/>
++ <classpathentry kind="lib" path="lib/commons-jxpath-1.3.jar"/>
++ <classpathentry kind="lib" path="lib/poi-3.6-20091214.jar"/>
++ <classpathentry kind="lib" path="lib/poi-scratchpad-3.6-20091214.jar"/>
++ <classpathentry kind="lib" path="lib/bcmail-jdk15-145.jar"/>
++ <classpathentry kind="lib" path="lib/bcprov-jdk15-145.jar"/>
++ <classpathentry kind="lib" path="lib/jsch-0.1.42.jar"/>
++ <classpathentry kind="lib" path="lib/jakarta-oro-2.0.8.jar"/>
++ <classpathentry kind="lib" path="lib/mysql-connector-java-5.1.12-bin.jar"/>
++ <classpathentry kind="lib" path="lib/apache-mime4j-0.6.jar"/>
++ <classpathentry kind="lib" path="lib/commons-fileupload-1.2.2.jar"/>
++ <classpathentry kind="lib" path="lib/json-simple-1.1.jar"/>
++ <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
++ <classpathentry kind="lib" path="lib/xml-apis.jar"/>
++ <classpathentry kind="lib" path="lib/geronimo-stax-api_1.0_spec-1.0.1.jar"/>
++ <classpathentry kind="lib" path="lib/commons-io-2.1.jar"/>
++ <classpathentry kind="lib" path="lib/commons-compress-1.4.1.jar"/>
++ <classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/>
++ <classpathentry kind="lib" path="lib/servlet-api-2.5-20081211.jar"/>
++ <classpathentry kind="lib" path="lib/jaudiotagger-2.0.4-20111207.115108-15.jar"/>
++ <classpathentry kind="lib" path="lib/commons-codec-1.7.jar"/>
++ <classpathentry kind="lib" path="lib/spatial4j-0.3.jar"/>
++ <classpathentry kind="lib" path="lib/jcl-over-slf4j-1.7.2.jar"/>
++ <classpathentry kind="lib" path="lib/slf4j-api-1.7.2.jar"/>
++ <classpathentry kind="lib" path="lib/zookeeper-3.4.5.jar"/>
++ <classpathentry kind="lib" path="lib/guava-13.0.1.jar"/>
++ <classpathentry kind="lib" path="lib/wstx-asl-3.2.9.jar"/>
++ <classpathentry kind="lib" path="lib/slf4j-jdk14-1.7.2.jar"/>
++ <classpathentry kind="lib" path="lib/log4j-over-slf4j-1.7.2.jar"/>
++ <classpathentry kind="lib" path="lib/httpclient-4.2.5.jar"/>
++ <classpathentry kind="lib" path="lib/httpcore-4.2.4.jar"/>
++ <classpathentry kind="lib" path="lib/httpmime-4.2.5.jar"/>
++ <classpathentry kind="lib" path="lib/noggit-0.5.jar"/>
++ <classpathentry kind="lib" path="lib/metadata-extractor-2.6.2.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-analyzers-common-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-analyzers-phonetic-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-classification-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-codecs-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-core-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-facet-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-grouping-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-highlighter-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-join-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-memory-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-misc-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-queries-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-queryparser-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-spatial-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/lucene-suggest-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/solr-core-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/solr-solrj-4.4.0.jar"/>
++ <classpathentry kind="lib" path="lib/jcifs-1.3.17.jar"/>
++ <classpathentry kind="lib" path="lib/fontbox-1.8.2.jar"/>
++ <classpathentry kind="lib" path="lib/jempbox-1.8.2.jar"/>
++ <classpathentry kind="lib" path="lib/pdfbox-1.8.2.jar"/>
++ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
++ <classpathentry kind="lib" path="lib/icu4j-core.jar"/>
++ <classpathentry kind="lib" path="lib/htmllexer.jar"/>
++ <classpathentry kind="lib" path="lib/jena-2.6.4.jar"/>
++ <classpathentry kind="lib" path="lib/sax-2.0.1.jar"/>
++ <classpathentry kind="lib" path="lib/arq-2.8.7.jar"/>
++ <classpathentry kind="lib" path="lib/iri-0.8.jar"/>
++ <classpathentry kind="lib" path="lib/jsoup-1.6.3.jar"/>
++ <classpathentry kind="output" path="gen"/>
++ <classpathentry kind="src" path="htroot/api/bookmarks/posts"/>
++ <classpathentry kind="src" path="htroot/api/bookmarks/tags"/>
++ <classpathentry kind="src" path="htroot/api/bookmarks/xbel"/>
++ <classpathentry kind="src" path="htroot/api/ymarks"/>
++ <classpathentry kind="src" path="htroot/env"/>
++ <classpathentry kind="src" path="htroot/yacy"/>
++ <classpathentry kind="src" path="source"/>
++</classpath>
diff --cc build.xml
index 794d50f63,344202fbd..b6a199fda
--- a/build.xml
+++ b/build.xml
@@@ -1,811 -1,816 +1,823 @@@
--<project name="YaCy" default="all" basedir=".">
-- <description>
-- YaCy - a Peer to Peer Web Search Engine
-- </description>
--
-- <!--
--# THIS IS THE YACY BUILD SCRIPT
--# YOU CAN USE IT TO COMPILE YOUR OWN RELEASE
--# THE TARGET OF THE COMPILATION CAN BE FOUND
--# IN THE 'RELEASE' DIRECTORY AFTERWARDS
--# YOU NEED APACHE ANT TO USE THIS SCRIPT
--# ==========================================
--# This Software is Copyrighted
--# (C) by Michael Peter Christen; [email protected]
--# first published on http://yacy.net
--# Frankfurt, Germany, 2005-2009
--#
--# This program is free software; you can redistribute it and/or modify
--# it under the terms of the GNU General Public License as published by
--# the Free Software Foundation; either version 2 of the License, or
--# (at your option) any later version.
--
--# This program is distributed in the hope that it will be useful,
--# but WITHOUT ANY WARRANTY; without even the implied warranty of
--# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--# GNU General Public License for more details.
--
--# You should have received a copy of the GNU General Public License
--# along with this program; if not, write to the Free Software
--# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---->
--
-- <!-- defining the timestamp format -->
-- <tstamp>
-- <format property="REPL_DATE_FORMAT" pattern="yyyymmdd" />
-- </tstamp>
--
-- <!-- defining all needed directory names -->
-- <property name="yacyroot" location="."/>
-- <property name="addon" location="addon"/>
-- <property name="src" location="source"/>
-- <property name="data" location="DATA"/>
-- <property name="lib" location="lib"/>
-- <property name="libt" location="libt"/>
-- <property name="libbuild" location="libbuild"/>
-- <property name="build" location="classes"/>
-- <property name="javadoc" location="api"/>
-- <property name="htroot" location="htroot"/>
-- <property name="test" location="test"/>
-- <property name="langstats" location="langstats"/>
-- <property name="locales" location="locales"/>
-- <property name="skins" location="skins"/>
- <property name="ranking" location="ranking"/>
-- <property name="release" location="RELEASE"/>
-- <property name="htdocsWWW" location="${data}/HTDOCS/www"/>
-- <property name="release_main" location="${release}/MAIN"/>
-- <property name="release_windows" location="${release}/WINDOWS"/>
-- <property name="release_mac" location="${release}/MAC"/>
-- <property name="git" location=".git"/>
-- <property name="defaults" location="defaults"/>
-- <property name="RDFaParser" location="RDFaParser"/>
-
- <!-- pseudo default branch as fallback -->
- <property name="branch" value="" />
--
-- <!-- pseudo default releaseNr as fallback -->
-- <property name="releaseNr" value="9000" />
--
-- <!-- defining all needed directory names for packing search widget-->
-- <property name="jquery" location="htroot/jquery/"/>
-- <property name="portalsearch" location="htroot/portalsearch/"/>
-- <property name="img-2" location="htroot/yacy/ui/img-2"/>
--
-- <!-- variables for installonlinux target-->
-- <property name="DESTDIR" value="DESTDIR"/>
-- <property name="PKGMANAGER" value="false"/>
-- <property name="RESTARTCMD" value="/etc/init.d/yacy restart"/>
--
-- <!-- determining if the .git directory exists -->
-- <condition property="isGit">
-- <available file="${git}" />
-- </condition>
--
-- <target name="buildGitRevTask">
-- <delete file="${libbuild}/GitRevTask.jar" failonerror="false" />
-- <javac srcdir="${libbuild}/GitRevTask" includeantruntime="true">
-- <classpath>
-- <pathelement location="${libbuild}/org.eclipse.jgit-1.1.0.201109151100-r.jar" />
-- </classpath>
-- </javac>
-- <jar destfile="${libbuild}/GitRevTask.jar" basedir="${libbuild}/GitRevTask">
-- <manifest>
-- <attribute name="Main-Class" value="GitRevTask"/>
-- </manifest>
-- </jar>
-- </target>
--
-- <target name="determineGitRevision" if="isGit" depends="buildGitRevTask">
-- <taskdef resource="GitRevTask.properties">
-- <classpath>
-- <pathelement location="${libbuild}/GitRevTask.jar" />
-- <pathelement location="${libbuild}/org.eclipse.jgit-1.1.0.201109151100-r.jar" />
-- </classpath>
-- </taskdef>
- <gitRev repoPath="${yacyroot}" revprop="releaseNr" dateprop="DSTAMP" />
- <gitRev repoPath="${yacyroot}" branchprop="branch" revprop="releaseNr" dateprop="DSTAMP" />
-- </target>
--
-- <!-- reading the build properties from file -->
-- <target name="readBuildProperties" depends="determineGitRevision">
-- <!-- loading some property values from file -->
-- <loadproperties srcFile="build.properties" />
-- </target>
--
-- <!-- initializing all needed variables -->
-- <target name="init" depends="readBuildProperties">
-- <mkdir dir="${data}"/>
-- <mkdir dir="${release}"/>
--
-- <!-- YaCy Release Date -->
-- <filter token="REPL_DATE" value="${DSTAMP}"/>
-- <filter token="REPL_RELEASE" value="${stdReleaseFile}"/>
-
- <!-- YaCy Brach -->
- <echo message="YaCy Branch: ${branch}" />
--
-- <!-- YaCy Release Version number -->
-- <echo message="YaCy Version number: ${releaseVersion}" />
-- <filter token="REPL_VERSION" value="${releaseVersion}" />
--
-- <!-- YaCy Release <revision number -->
-- <echo message="YaCy Release number: ${releaseNr}" />
-- <filter token="REPL_REVISION_NR" value="${releaseNr}"/>
--
-- <!-- YaCy root directory -->
-- <filter token="REPL_YACY_ROOT_DIR" value="${yacyroot}"/>
-- <filter token="REPL_PKGMANAGER" value="${PKGMANAGER}"/>
-- <filter token="REPL_RESTARTCMD" value="${RESTARTCMD}"/>
--
-- <!-- apply replacments -->
-- <delete file="${build}/net/yacy/peers/operation/yacyBuildProperties.java" failonerror="false"/>
-- <copy file="${src}/net/yacy/peers/operation/yacyBuildProperties.java" tofile="${build}/net/yacy/peers/operation/yacyBuildProperties.java" overwrite="true" filtering="true" />
--
-- <!-- copy log4j config file -->
-- <copy file="${src}/log4j.properties" tofile="${build}/log4j.properties" overwrite="true" filtering="true" />
--
-- </target>
--
-- <target name="javadoc" depends="init" description="make javadoc for YaCy core">
-- <javadoc destdir="${javadoc}"
-- windowtitle="YaCy API"
-- encoding="UTF-8"
-- charset="UTF-8"
-- access="private">
-- <fileset dir="${src}">
-- <include name="**/*.java"/>
-- </fileset>
-- </javadoc>
-- </target>
--
-- <!-- define the classpath that should be used for compiling -->
-- <!-- when changing paths here, please also update the paths in /addon/YaCy.app/Contents/Info.plist -->
-- <path id="project.class.path">
-- <pathelement location="${build}" />
-- <pathelement location="${htroot}" />
- <pathelement location="${lib}/jetty-http-7.3.0.v20110203.jar" />
- <pathelement location="${lib}/jetty-io-7.3.0.v20110203.jar" />
- <pathelement location="${lib}/jetty-security-7.3.0.v20110203.jar" />
- <pathelement location="${lib}/jetty-server-7.3.0.v20110203.jar" />
- <pathelement location="${lib}/jetty-servlet-7.3.0.v20110203.jar" />
- <pathelement location="${lib}/jetty-servlets-7.3.0.v20110203.jar" />
- <pathelement location="${lib}/jetty-util-7.3.0.v20110203.jar" />
-- <pathelement location="${lib}/activation.jar" />
- <pathelement location="${lib}/apache-mime4j-0.6.jar" />
- <pathelement location="${lib}/arq-2.8.7.jar" />
-- <pathelement location="${lib}/bcmail-jdk15-145.jar" />
-- <pathelement location="${lib}/bcprov-jdk15-145.jar" />
- <pathelement location="${lib}/commons-codec-1.6.jar" />
- <pathelement location="${lib}/commons-codec-1.7.jar" />
-- <pathelement location="${lib}/commons-compress-1.4.1.jar" />
-- <pathelement location="${lib}/commons-fileupload-1.2.2.jar" />
- <pathelement location="${lib}/commons-httpclient-3.1.jar" />
-- <pathelement location="${lib}/commons-io-2.1.jar" />
-- <pathelement location="${lib}/commons-jxpath-1.3.jar" />
-- <pathelement location="${lib}/commons-lang-2.6.jar" />
-- <pathelement location="${lib}/commons-logging-1.1.1.jar" />
- <pathelement location="${lib}/fontbox-1.7.0.jar" />
- <pathelement location="${lib}/jcifs-1.3.14.jar" />
- <pathelement location="${lib}/jcifs-1.3.15.jar" />
- <pathelement location="${lib}/jcl-over-slf4j-1.6.1.jar" />
- <pathelement location="${lib}/jempbox-1.7.0" />
- <pathelement location="${lib}/fontbox-1.8.2.jar" />
- <pathelement location="${lib}/geronimo-stax-api_1.0_spec-1.0.1.jar" />
- <pathelement location="${lib}/guava-13.0.1.jar" />
- <pathelement location="${lib}/htmllexer.jar" />
- <pathelement location="${lib}/httpclient-4.2.5.jar" />
- <pathelement location="${lib}/httpcore-4.2.4.jar" />
- <pathelement location="${lib}/httpmime-4.2.5.jar" />
- <pathelement location="${lib}/icu4j-core.jar" />
- <pathelement location="${lib}/iri-0.8.jar" />
- <pathelement location="${lib}/J7Zip-modified.jar" />
- <pathelement location="${lib}/jakarta-oro-2.0.8.jar" />
- <pathelement location="${lib}/jaudiotagger-2.0.4-20111207.115108-15.jar" />
- <pathelement location="${lib}/jcifs-1.3.17.jar" />
- <pathelement location="${lib}/jcl-over-slf4j-1.7.2.jar" />
- <pathelement location="${lib}/jempbox-1.8.2" />
-- <pathelement location="${lib}/jena-2.6.4.jar" />
- <pathelement location="${lib}/jetty-6.1.26-patched-JETTY-1340.jar" />
- <pathelement location="${lib}/jetty-util-6.1.26-patched-JETTY-1340.jar" />
-- <pathelement location="${lib}/jsch-0.1.42.jar" />
-- <pathelement location="${lib}/json-simple-1.1.jar" />
- <pathelement location="${lib}/log4j-1.2.16.jar" />
- <pathelement location="${lib}/log4j-over-slf4j-1.6.1.jar" />
- <pathelement location="${lib}/lucene-analyzers-3.6.0.jar" />
- <pathelement location="${lib}/lucene-core-3.6.0.jar" />
- <pathelement location="${lib}/lucene-highlighter-3.6.0.jar" />
- <pathelement location="${lib}/lucene-phonetic-3.6.0.jar" />
- <pathelement location="${lib}/lucene-spatial-3.6.0.jar" />
- <pathelement location="${lib}/lucene-spellchecker-3.6.0.jar" />
- <pathelement location="${lib}/metadata-extractor-2.4.0-beta-1.jar" />
- <pathelement location="${lib}/jsoup-1.6.3.jar" />
- <pathelement location="${lib}/log4j-over-slf4j-1.7.2.jar" />
- <pathelement location="${lib}/lucene-analyzers-common-4.4.0.jar" />
- <pathelement location="${lib}/lucene-analyzers-phonetic-4.4.0.jar" />
- <pathelement location="${lib}/lucene-classification-4.4.0.jar" />
- <pathelement location="${lib}/lucene-codecs-4.4.0.jar" />
- <pathelement location="${lib}/lucene-core-4.4.0.jar" />
- <pathelement location="${lib}/lucene-facet-4.4.0.jar" />
- <pathelement location="${lib}/lucene-grouping-4.4.0.jar" />
- <pathelement location="${lib}/lucene-highlighter-4.4.0.jar" />
- <pathelement location="${lib}/lucene-join-4.4.0.jar" />
- <pathelement location="${lib}/lucene-memory-4.4.0.jar" />
- <pathelement location="${lib}/lucene-misc-4.4.0.jar" />
- <pathelement location="${lib}/lucene-queries-4.4.0.jar" />
- <pathelement location="${lib}/lucene-queryparser-4.4.0.jar" />
- <pathelement location="${lib}/lucene-spatial-4.4.0.jar" />
- <pathelement location="${lib}/lucene-suggest-4.4.0.jar" />
- <pathelement location="${lib}/metadata-extractor-2.6.2.jar" />
-- <pathelement location="${lib}/mysql-connector-java-5.1.12-bin.jar" />
- <pathelement location="${lib}/noggit-0.5.jar" />
- <pathelement location="${lib}/pdfbox-1.8.2.jar" />
-- <pathelement location="${lib}/poi-3.6-20091214.jar" />
-- <pathelement location="${lib}/poi-scratchpad-3.6-20091214.jar" />
-- <pathelement location="${lib}/sax-2.0.1.jar" />
- <pathelement location="${lib}/servlet-api-2.5-20081211.jar" />
- <pathelement location="${lib}/slf4j-api-1.7.2.jar" />
- <pathelement location="${lib}/slf4j-jdk14-1.7.2.jar" />
- <pathelement location="${lib}/solr-core-4.4.0.jar" />
- <pathelement location="${lib}/solr-solrj-4.4.0.jar" />
- <pathelement location="${lib}/spatial4j-0.3.jar" />
-- <pathelement location="${lib}/webcat-0.1-swf.jar" />
- <pathelement location="${lib}/wstx-asl-3.2.7.jar" />
- <pathelement location="${lib}/wstx-asl-3.2.9.jar" />
-- <pathelement location="${lib}/xercesImpl.jar" />
-- <pathelement location="${lib}/xml-apis.jar" />
- <pathelement location="${lib}/J7Zip-modified.jar" />
- <pathelement location="${lib}/apache-mime4j-0.6.jar" />
- <pathelement location="${lib}/apache-solr-core-3.6.0.jar" />
- <pathelement location="${lib}/apache-solr-solrj-3.6.0.jar" />
- <pathelement location="${lib}/arq-2.8.7.jar" />
- <pathelement location="${lib}/geronimo-stax-api_1.0_spec-1.0.1.jar" />
- <pathelement location="${lib}/guava-r05.jar" />
- <pathelement location="${lib}/htmllexer.jar" />
- <pathelement location="${lib}/htmlparser.jar" />
- <pathelement location="${lib}/httpclient-4.2.jar" />
- <pathelement location="${lib}/httpcore-4.2.jar" />
- <pathelement location="${lib}/httpmime-4.2.jar" />
- <pathelement location="${lib}/icu4j-core.jar" />
- <pathelement location="${lib}/iri-0.8.jar" />
- <pathelement location="${lib}/jakarta-oro-2.0.8.jar" />
- <pathelement location="${lib}/jetty-continuation-7.3.0.v20110203.jar" />
- <pathelement location="${lib}/pdfbox-1.7.0.jar" />
- <pathelement location="${lib}/servlet-api-2.5-20081211.jar" />
- <pathelement location="${lib}/slf4j-api-1.6.1.jar" />
- <pathelement location="${lib}/slf4j-jdk14-1.6.1.jar" />
- <pathelement location="${lib}/zookeeper-3.4.5.jar" />
-- </path>
--
-- <target name="compile-core" depends="init" description="compile YaCy core">
--
-- <!-- compile yacyBuildProperties.java -->
-- <javac srcdir="${build}" destdir="${build}" sourcepath="${src}"
-- debug="true" debuglevel="lines,vars,source" includeantruntime="false"
-- includes="net/yacy/peers/operation/yacyBuildProperties.java"
-- source="${javacSource}" target="${javacTarget}">
-- <classpath refid="project.class.path" />
-- <compilerarg value="-Xlint"/>
-- </javac>
-- <delete file="${build}/BuildProperties.java" />
--
-- <!-- compile the core sources -->
-- <javac srcdir="${src}/" destdir="${build}"
-- debug="true" debuglevel="lines,vars,source" includeantruntime="false"
-- excludes="net/yacy/peers/operation/yacyBuildProperties.java"
-- source="${javacSource}" target="${javacTarget}">
-- <classpath refid="project.class.path" />
-- <compilerarg value="-Xlint"/>
-- </javac>
--
- <!-- prepare classpath for MANIFEST (manifest cp is relative to jar) -->
- <path id="project.classpath.runtime">
- <fileset dir="./lib">
- <include name="**/*.jar" />
- <exclude name="yacycore.jar"/>
- </fileset>
- </path>
- <pathconvert property="manifest.classpath" pathsep=" " refid="project.classpath.runtime">
- <flattenmapper/>
- </pathconvert>
-
-- <!-- make the jacycore jar -->
-- <jar destfile="${lib}/yacycore.jar" basedir="${build}/">
-- <manifest>
- <attribute name="Main-Class" value="yacy"/>
- <attribute name="Main-Class" value="net.yacy.yacy"/>
- <attribute name="Class-Path" value="${manifest.classpath}"/>
-- </manifest>
-- </jar>
--
-- </target>
--
-- <target name="compile-cora" depends="init" description="compile YaCy cora component">
-- <!-- compile the cora sources -->
-- <javac srcdir="${src}/net/yacy/cora/" destdir="${build}/"
-- debug="true" debuglevel="lines,vars,source"
-- source="${javacSource}" target="${javacTarget}">
-- <classpath refid="project.class.path" />
-- <compilerarg value="-Xlint"/>
-- </javac>
--
-- <!-- make yacy-cora.jar -->
-- <jar destfile="${lib}/yacy-cora.jar" includes="**/net/yacy/cora/**" basedir="${build}/"></jar>
--
-- </target>
--
--
-- <target name="compile" depends="compile-core" description="compile YaCy core and YaCy servlets">
-- <!-- compile htroot, htroot/yacy and htroot/htdocsdefault -->
-- <javac srcdir="${htroot}/"
-- excludes="processing/**"
-- source="${javacSource}" target="${javacTarget}"
-- debug="true" debuglevel="lines,vars,source" includeantruntime="false">
-- <classpath refid="project.class.path" />
-- <compilerarg value="-Xlint"/>
-- </javac>
-- </target>
--
-- <target name="all" depends="compile">
-- </target>
--
-- <target name="copyMain4Dist" depends="compile">
-- <!-- copy all libs -->
-- <copy todir="${release_main}/lib">
-- <fileset dir="${lib}"
-- includes="**/*"/>
-- </copy>
--
-- <!-- copy build libs -->
-- <copy todir="${release_main}/libbuild">
-- <fileset dir="${libbuild}"
-- includes="**/*"/>
-- </copy>
--
-- <!-- copy configuration files -->
-- <copy todir="${release_main}">
-- <fileset dir=".">
-- <include name="yacy.yellow"/>
-- <include name="yacy.badwords.example"/>
-- <include name="yacy.stopwords"/>
-- <include name="yacy.parser"/>
-- </fileset>
-- </copy>
--
-- <!-- copy defaults -->
-- <copy todir="${release_main}/defaults">
-- <fileset dir="${defaults}"
-- includes="**/*"/>
-- </copy>
--
-- <!-- copy Unix wrappers -->
-- <copy todir="${release_main}">
-- <fileset dir=".">
-- <include name="startYACY.sh"/>
-- <include name="stopYACY.sh"/>
-- <include name="killYACY.sh"/>
-- <include name="updateYACY.sh"/>
-- <include name="restart.sh"/>
-- <include name="reconfigureYACY.sh"/>
-- <include name="startYACY.command"/>
-- <include name="stopYACY.command"/>
-- </fileset>
-- </copy>
--
-- <!-- copy other wrappers -->
-- <copy todir="${release_main}">
-- <fileset dir=".">
-- <include name="startYACY.bat"/>
-- <include name="startYACY_debug.bat"/>
-- <include name="stopYACY.bat"/>
-- <include name="getWin32MaxHeap.bat"/>
-- </fileset>
-- </copy>
--
-- <!-- copy locales -->
-- <copy todir="${release_main}/locales">
-- <fileset dir="${locales}">
-- <include name="*"/>
-- </fileset>
-- </copy>
--
-- <!-- copy skins -->
-- <copy todir="${release_main}/skins">
-- <fileset dir="${skins}">
-- <include name="*"/>
-- </fileset>
-- </copy>
--
-- <!-- copy language statistics files -->
-- <copy todir="${release_main}/langstats">
-- <fileset dir="${langstats}">
-- <include name="*"/>
-- </fileset>
-- </copy>
--
-- <!-- copy documentation -->
-- <copy todir="${release_main}">
-- <fileset dir=".">
-- <include name="readme.txt"/>
-- <include name="gpl.txt"/>
-- <include name="ChangeLog"/>
-- <include name="AUTHORS"/>
-- <include name="COPYRIGHT"/>
-- <include name="NOTICE"/>
-- </fileset>
-- </copy>
--
-- <!-- copy source code -->
-- <copy todir="${release_main}/source">
-- <fileset dir="${src}">
-- <include name="**/*.*"/>
-- </fileset>
-- </copy>
--
-- <!-- copy server pages -->
-- <copy todir="${release_main}/htroot">
-- <fileset dir="${htroot}">
-- <include name="**/*"/>
-- </fileset>
-- </copy>
--
-- <!-- copy add-on's -->
-- <copy todir="${release_main}/addon">
-- <fileset dir="${addon}">
- <include name="**/*"/>
- </fileset>
- </copy>
-
- <!-- copy ranking files -->
- <copy todir="${release_main}/ranking">
- <fileset dir="${ranking}">
-- <include name="**/*"/>
-- </fileset>
-- </copy>
--
-- <!-- copy development tools -->
-- <copy todir="${release_main}">
-- <fileset dir=".">
-- <include name="build.xml"/>
-- <include name="build.properties"/>
-- </fileset>
-- </copy>
--
-- <!-- copy searchtest -->
-- <copy todir="${release_main}/bin">
-- <fileset dir="bin">
-- <include name="**/*.sh"/>
-- <include name="searchtest*"/>
-- </fileset>
-- </copy>
--
-- </target>
--
-- <!-- run unittests-->
-- <target name="compileTest" depends="compile" description="run unittests">
-- <javac srcdir="${test}" destdir="${test}"
-- debug="true" debuglevel="lines,vars,source"
-- source="${javacSource}" target="${javacTarget}">
-- <classpath>
-- <pathelement location="${build}"/>
-- <pathelement location="${htroot}"/>
- <pathelement location="${libt}/junit-4.7.jar" />
- <fileset dir="${libt}" includes="**/*.jar" />
-- <fileset dir="${lib}" includes="**/*.jar" />
-- </classpath>
-- <compilerarg value="-Xlint"/>
-- </javac>
-- </target>
--
-- <target name="test" depends="compileTest" description="run some unittests">
- <junit printsummary="yes" haltonfailure="no">
- <junit printsummary="yes" haltonfailure="no" fork="true" dir="${yacyroot}">
-- <formatter type="plain"/>
-- <batchtest>
-- <fileset dir="${test}">
-- <include name="**/*Test*.java"/>
-- </fileset>
-- </batchtest>
-- <classpath>
-- <pathelement location="${test}"/>
-- <pathelement location="${build}"/>
-- <pathelement location="${htroot}"/>
- <pathelement location="${libt}/junit-4.7.jar" />
- <fileset dir="${libt}" includes="**/*.jar" />
-- <fileset dir="${lib}" includes="**/*.jar" />
-- </classpath>
-- </junit>
-- </target>
--
-- <!-- =======================================================================================================
-- making a release file for yacy
-- ======================================================================================================= -->
--
-- <target name="dist" depends="copyMain4Dist" description="make for standard YaCy">
-- <tar destfile="${release}/${stdReleaseFile}" compression="gzip" defaultexcludes="yes" longfile="fail">
--
-- <!-- packing all files into a gzipped tar -->
-- <tarfileset dir="${release_main}" prefix="${releaseFileParentDir}/" dirmode="${accessRightsDir}" mode="${accessRightsExecutable}">
-- <include name="**/*.sh"/>
-- <include name="**/*.command"/>
-- </tarfileset>
-- <tarfileset dir="${release_main}" prefix="${releaseFileParentDir}/" dirmode="${accessRightsDir}" mode="${accessRightsFile}" >
-- <include name="**/*"/>
-- <exclude name="**/*.sh"/>
-- <exclude name="**/*.command"/>
-- </tarfileset>
-- </tar>
--
-- <delete dir="${release_main}"/>
-- <delete dir="${release_windows}" failonerror="false" />
-- <delete dir="${release}/SPECS" failonerror="false" />
-- </target>
--
-- <!-- packing YaCy search widget for static hosting -->
-- <target name="portalsearch" description="pack YaCy search widget for static hosting">
-- <tar destfile="${release}/yacy-portalsearch.tar.gz" compression="gzip" defaultexcludes="yes" longfile="fail">
-- <tarfileset dir="${portalsearch}" prefix="yacy/portalsearch/">
-- <include name="*.*"/>
-- </tarfileset>
-- <tarfileset dir="${jquery}" prefix="yacy/jquery/">
-- <include name="**/*"/>
-- </tarfileset>
-- <tarfileset dir="${img-2}" prefix="yacy/ui/img-2/">
-- <include name="magnify.png"/>
-- <include name="cancel_round.png"/>
-- <include name="stop.png"/>
-- </tarfileset>
-- </tar>
-- </target>
--
-- <!-- make clean -->
-- <target name="clean" description="make clean">
-- <delete dir="${release_main}" failonerror="false"/>
-- <delete file="${build}/net/yacy/peers/operation/yacyBuildProperties.java" failonerror="false"/>
-- <delete file="${build}/log4j.properties" failonerror="false"/>
-- <delete file="${lib}/yacycore.jar" failonerror="false"/>
- <delete file="${lib}/yacy-cora.jar" failonerror="false"/>
-- <delete file="${lib}/svnRevNr.jar" failonerror="false"/>
-- <delete file="${libbuild}/svnRevNr.jar" failonerror="false"/>
- <delete file="${libbuild}/GitRevTask.jar" failonerror="false"/>
- <delete file="${libbuild}/GitRevTask.jar" failonerror="false"/>
-- <delete failonerror="false">
-- <fileset dir="${src}" includes="**/*.class" />
-- <fileset dir="${build}" includes="**/*.class" />
-- <fileset dir="${htroot}" includes="**/*.class" />
-- <fileset dir="test/" includes="**/*.class" />
-- <fileset dir="${libbuild}/svnRevNr" includes="**/*.class" />
-- <fileset dir="${libbuild}/GitRevTask" includes="**/*.class" />
-- <fileset dir="." includes="TEST-*" />
-- </delete>
- <delete dir="test/DATA" failonerror="false"/>
-- </target>
--
-- <target name="installonlinux">
--
-- <!-- copy configuration files -->
-- <copy todir="${DESTDIR}/usr/share/yacy">
-- <fileset dir=".">
-- <include name="yacy.logging"/>
-- <include name="yacy.yellow"/>
-- <include name="yacy.badwords.example"/>
-- <include name="yacy.stopwords"/>
-- <include name="yacy.parser"/>
-- <include name="httpd.mime"/>
-- </fileset>
-- </copy>
--
-- <!-- copy defaults -->
-- <copy todir="${DESTDIR}/usr/share/yacy/defaults">
-- <fileset dir="${defaults}" includes="**/*"/>
-- </copy>
--
-- <!-- copy locales -->
-- <copy todir="${DESTDIR}/usr/share/yacy/locales">
-- <fileset dir="${locales}">
-- <include name="*"/>
-- </fileset>
-- </copy>
--
-- <!-- copy skins -->
-- <copy todir="${DESTDIR}/usr/share/yacy/skins">
-- <fileset dir="${skins}">
-- <include name="*"/>
-- </fileset>
-- </copy>
--
-- <!-- copy language statistics files -->
-- <copy todir="${DESTDIR}/usr/share/yacy/langstats">
-- <fileset dir="${langstats}">
-- <include name="*"/>
-- </fileset>
-- </copy>
--
-- <!-- copy shell scripts from bin/ -->
-- <!-- i'm not sure, if this is consistent with the debian policy -->
-- <!-- but for /usr/bin or /usr/lib we need an extra environment variable -->
-- <copy todir="${DESTDIR}/usr/share/yacy/bin">
-- <fileset dir="bin/">
-- <include name="*"/>
-- </fileset>
-- </copy>
-- <chmod dir="${DESTDIR}/usr/share/yacy/bin/" perm="755" includes="*"/>
--
-- <!-- copy documentation -->
-- <copy todir="${DESTDIR}/usr/share/doc/yacy">
-- <fileset dir=".">
-- <include name="readme.txt"/>
-- <include name="ChangeLog"/>
-- <include name="AUTHORS"/>
-- <include name="COPYRIGHT"/>
-- <include name="NOTICE"/>
-- </fileset>
-- </copy>
--
-- <!-- copy server pages -->
-- <copy todir="${DESTDIR}/usr/share/yacy/htroot">
-- <fileset dir="${htroot}">
-- <include name="**/*"/>
-- <exclude name="yacy/seedUpload/**"/>
-- </fileset>
-- <fileset dir="${htroot}">
-- <include name="yacy/seedUpload/yacySeedUploadFile.html"/>
-- <include name="yacy/seedUpload/yacySeedUploadFtp.html"/>
- </fileset>
- </copy>
-
- <!-- copy ranking files -->
- <copy todir="${DESTDIR}/usr/share/yacy/ranking">
- <fileset dir="${ranking}">
- <include name="**/*"/>
-- </fileset>
-- </copy>
--
-- <!-- prepare /var/lib/yacy -->
-- <mkdir dir="${DESTDIR}/var/lib/yacy" />
-- <mkdir dir="${DESTDIR}/var/lib/yacy/LOG" />
-- <mkdir dir="${DESTDIR}/var/lib/yacy/SETTINGS" />
-- <mkdir dir="${DESTDIR}/etc" />
-- <mkdir dir="${DESTDIR}/var/log" />
-- <symlink link="${DESTDIR}/usr/share/yacy/DATA"
-- resource="../../../var/lib/yacy"/>
-- <symlink link="${DESTDIR}/etc/yacy"
-- resource="../var/lib/yacy/SETTINGS"/>
-- <symlink link="${DESTDIR}/var/log/yacy"
-- resource="../lib/yacy/LOG"/>
--
-- </target>
--
-- <!-- run YaCy (needed for NetBeans4) -->
-- <target name="run" description="Run YaCy">
-- <!-- debug options:
-- java -Xrunhprof:help
-- Hprof usage: -Xrunhprof[:help]|[:<option>=<value>, ...]
--
-- Option Name and Value Description Default
-- _____________________ ___________ _______
-- heap=dump|sites|all heap profiling all
-- cpu=samples|times|old CPU usage off
-- monitor=y|n monitor contention n
-- format=a|b ascii or binary output a
-- file=<file> write data to file java.hprof(.txt for ascii)
-- net=<host>:<port> send data over a socket write to file
-- depth=<size> stack trace depth 4
-- cutoff=<value> output cutoff point 0.0001
-- lineno=y|n line number in traces? y
-- thread=y|n thread in traces? n
-- doe=y|n dump on exit? y
-- gc_okay=y|n GC okay during sampling y
--
-- Example: java -Xrunhprof:cpu=samples,file=log.txt,depth=3 FooClass
--
-- Note: format=b cannot be used with cpu=old|times
---->
-- <java classname="net.yacy.yacy" fork="yes">
-- <classpath>
-- <pathelement location="${build}"/>
-- <pathelement location="${htroot}"/>
-- <pathelement location="${lib}" />
-- <fileset dir="${lib}" includes="**/*.jar" />
-- </classpath>
-- <!--<arg value="-Xrunhprof"/>-->
-- <arg line="-start"/>
-- <jvmarg line="-Xms180m"/>
-- <jvmarg line="-Xmx512m"/>
-- <!-- <arg line="-migratewords"/>-->
-- <!-- <arg line="-start ${user.dir}"/>-->
-- </java>
-- </target>
--
-- <!-- run a single file (selected in NetBeans4) -->
-- <target name="run-single" depends="compile" description="Run Single File">
-- <fail unless="classname">Must set property 'classname'</fail>
-- <java classname="net.yacy.yacy" fork="yes">
-- <classpath refid="run.classpath"/>
-- <classpath>
-- <pathelement location="${build}"/>
-- <pathelement location="${htroot}"/>
-- <pathelement location="${lib}" />
-- <fileset dir="${lib}" includes="**/*.jar" />
-- </classpath>
-- <arg line=""/>
-- </java>
-- </target>
--
-- <!-- run YaCy with remote debugging enabled on port 8000 -->
-- <target name="debug" description="Debug YaCy">
-- <java classname="net.yacy.yacy" fork="yes">
-- <classpath>
-- <pathelement location="${build}"/>
-- <pathelement location="${htroot}"/>
-- <pathelement location="${lib}" />
-- <fileset dir="${lib}" includes="**/*.jar" />
-- </classpath>
-- <arg line="-start"/>
-- <jvmarg line="-Xdebug"/>
-- <jvmarg line="-Xnoagent"/>
-- <jvmarg line="-Djava.compiler=none"/>
- <jvmarg line="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"/>
- <jvmarg line="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"/>
-- </java>
-- </target>
--
-- <!-- stop YaCy again -->
-- <target name="stop" description="Stop YaCy">
-- <java classname="net.yacy.yacy" fork="yes">
-- <classpath>
-- <pathelement location="${build}"/>
-- <pathelement location="${htroot}"/>
-- <pathelement location="${lib}" />
-- <fileset dir="${lib}" includes="**/*.jar" />
-- </classpath>
-- <arg line="-stop"/>
-- </java>
-- </target>
--
--
-- <!-- create the html-documentation from javadoc -->
-- <target name="create-doc" description="Create the javadoc-HTML-Pages">
-- <javadoc destdir="doc/api"
-- author="true"
-- version="true"
-- use="false"
-- encoding="iso-8859-1"
-- windowtitle="YaCy API Documentation">
-- <classpath>
-- <fileset dir="${lib}">
-- <include name="**/*.jar"/>
-- </fileset>
-- <pathelement location="${build}"/>
-- </classpath>
-- <fileset dir="source" defaultexcludes="yes">
-- <include name="**/*.java" />
-- </fileset>
-- <fileset dir="htroot" defaultexcludes="yes">
-- <include name="**/*.java" />
-- </fileset>
-- </javadoc>
-- </target>
--
-- <target name="rpm" depends="all" description="Creates the main rpm-package and another for lib">
-- <mkdir dir="${release}/RPMS/noarch" />
-- <mkdir dir="${release}/BUILD" />
-- <copy file="addon/yacy-svn-4.spec" tofile="${release}/SPECS/yacy-svn.spec" overwrite="true" filtering="true" />
--
-- <rpm specFile="yacy-svn.spec" topDir="${release}" />
--
-- <move file="${release}/RPMS/noarch/yacy-${releaseVersion}_${releaseNr}-3.noarch.rpm"
-- tofile="${release}/yacy-${releaseVersion}_${releaseNr}-3.noarch.rpm" />
-- <move file="${release}/RPMS/noarch/yacy-lib-${releaseVersion}_${releaseNr}-3.noarch.rpm"
-- tofile="${release}/yacy-lib-${releaseVersion}_${releaseNr}-3.noarch.rpm" />
--
-- <delete dir="${release}/SPECS" failonerror="false" />
-- <delete dir="${release}/RPMS" failonerror="false" />
-- <delete dir="${release_windows}" failonerror="false" />
-- </target>
--
-- <target name="distWinInstaller" depends="copyMain4Dist" description="Creates an NSIS Windows installer">
-- <!-- http://nsisant.sourceforge.net/ -->
-- <mkdir dir="${release_windows}" />
-- <copy file="build.nsi" tofile="${release_windows}/build.nsi" overwrite="true" filtering="true" />
-- <taskdef name="nsis" classname="net.sf.nsisant.Task">
-- <classpath location="${libbuild}/nsisant-1.2.jar"/>
-- </taskdef>
-- <nsis script="${release_windows}/build.nsi" nocd="yes" verbosity="2" />
-- <move file="${release_windows}/yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.exe"
-- tofile="${release}/yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.exe" />
--
-- <delete dir="${release_main}"/>
-- <delete dir="${release_windows}" failonerror="false" />
-- </target>
--
-- <target name="distMacApp" depends="copyMain4Dist" description="Creates a YaCy.app">
-- <copy todir="${release_mac}/YaCy.app">
-- <fileset dir="${addon}/YaCy.app"></fileset>
-- </copy>
-- <copy file="${addon}/YaCy.app/Contents/Info.plist" tofile="${release_mac}/YaCy.app/Contents/Info.plist" filtering="true" overwrite="true" />
-- <move file="${release_main}" tofile="${release_mac}/YaCy.app/Contents/Resources/Java" verbose="false" />
-- <chmod file="${release_mac}/YaCy.app/Contents/MacOS/JavaApplicationStub" perm="755"/>
-- <exec executable="hdiutil">
-- <arg line="create -srcfolder ${release_mac}/YaCy.app ${release}/yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.dmg"/>
-- </exec>
-- <delete dir="${release_mac}" failonerror="false" verbose="false" />
-- </target>
--
-- <!-- to use the deb command the following debian packages must be installed: dpkg-dev debhelper m4 -->
-- <target name="deb" depends="init" description="Creates a debian package">
-- <!-- replacing the old with the new revision number -->
-- <replaceregexp file="debian/changelog"
-- match="yacy \(.*\) unstable; urgency=low"
-- replace="yacy (${releaseVersion}.${releaseNr}) unstable; urgency=low" />
--
-- <!-- build debian package -->
-- <exec executable="dpkg-buildpackage">
-- <arg value="-b"/>
-- <arg value="-rfakeroot"/>
-- <arg value="-uc"/>
-- </exec>
-- <replaceregexp file="debian/changelog"
-- match="yacy \(.*\) unstable; urgency=low"
-- replace="yacy (*auto-git-version*) unstable; urgency=low" />
-- </target>
--
-- <target name="sign" depends="readBuildProperties" description="sign current release file in RELEASE/ with ${privateKeyFile}">
-- <fail message="There is no release file (${release}/${stdReleaseFile}) that could be signed !">
-- <condition>
-- <not><available file="${stdReleaseFile}" filepath="${release}" type="file" /></not>
-- </condition>
-- </fail>
- <java classname="de.anomic.tools.CryptoLib" failonerror="true">
- <java classname="net.yacy.utils.CryptoLib" failonerror="true">
-- <classpath>
-- <pathelement location="${build}"/>
-- </classpath>
-- <arg line="--sign ${privateKeyFile} ${release}/${stdReleaseFile}"/>
-- </java>
-- </target>
--
-- <target name="genkey" depends="readBuildProperties" description="generate a pair of keys and write it to ${privateKeyFile} and ${privateKeyFile}.pub">
-- <fail message="There is already a private key file (${privateKeyFile})!">
-- <condition>
-- <available file="${privateKeyFile}" type="file" />
-- </condition>
-- </fail>
- <java classname="de.anomic.tools.CryptoLib" failonerror="true">
- <java classname="net.yacy.utils.CryptoLib" failonerror="true">
-- <classpath>
-- <pathelement location="${build}"/>
-- </classpath>
-- <arg line="--gen-key ${privateKeyFile} ${privateKeyFile}.pub"/>
-- </java>
-- <chmod file="${privateKeyFile}" perm="600"/>
-- </target>
--
-- <target name="deleteData" description="start with a fresh yacy installation">
-- <delete dir="${data}"/>
-- </target>
--</project>
++<project name="YaCy" default="all" basedir=".">
++ <description>
++ YaCy - a Peer to Peer Web Search Engine
++ </description>
++
++ <!--
++# THIS IS THE YACY BUILD SCRIPT
++# YOU CAN USE IT TO COMPILE YOUR OWN RELEASE
++# THE TARGET OF THE COMPILATION CAN BE FOUND
++# IN THE 'RELEASE' DIRECTORY AFTERWARDS
++# YOU NEED APACHE ANT TO USE THIS SCRIPT
++# ==========================================
++# This Software is Copyrighted
++# (C) by Michael Peter Christen; [email protected]
++# first published on http://yacy.net
++# Frankfurt, Germany, 2005-2009
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++-->
++
++ <!-- defining the timestamp format -->
++ <tstamp>
++ <format property="REPL_DATE_FORMAT" pattern="yyyymmdd" />
++ </tstamp>
++
++ <!-- defining all needed directory names -->
++ <property name="yacyroot" location="."/>
++ <property name="addon" location="addon"/>
++ <property name="src" location="source"/>
++ <property name="data" location="DATA"/>
++ <property name="lib" location="lib"/>
++ <property name="libt" location="libt"/>
++ <property name="libbuild" location="libbuild"/>
++ <property name="build" location="classes"/>
++ <property name="javadoc" location="api"/>
++ <property name="htroot" location="htroot"/>
++ <property name="test" location="test"/>
++ <property name="langstats" location="langstats"/>
++ <property name="locales" location="locales"/>
++ <property name="skins" location="skins"/>
++ <property name="release" location="RELEASE"/>
++ <property name="htdocsWWW" location="${data}/HTDOCS/www"/>
++ <property name="release_main" location="${release}/MAIN"/>
++ <property name="release_windows" location="${release}/WINDOWS"/>
++ <property name="release_mac" location="${release}/MAC"/>
++ <property name="git" location=".git"/>
++ <property name="defaults" location="defaults"/>
++ <property name="RDFaParser" location="RDFaParser"/>
++
++ <!-- pseudo default branch as fallback -->
++ <property name="branch" value="" />
++
++ <!-- pseudo default releaseNr as fallback -->
++ <property name="releaseNr" value="9000" />
++
++ <!-- defining all needed directory names for packing search widget-->
++ <property name="jquery" location="htroot/jquery/"/>
++ <property name="portalsearch" location="htroot/portalsearch/"/>
++ <property name="img-2" location="htroot/yacy/ui/img-2"/>
++
++ <!-- variables for installonlinux target-->
++ <property name="DESTDIR" value="DESTDIR"/>
++ <property name="PKGMANAGER" value="false"/>
++ <property name="RESTARTCMD" value="/etc/init.d/yacy restart"/>
++
++ <!-- determining if the .git directory exists -->
++ <condition property="isGit">
++ <available file="${git}" />
++ </condition>
++
++ <target name="buildGitRevTask">
++ <delete file="${libbuild}/GitRevTask.jar" failonerror="false" />
++ <javac srcdir="${libbuild}/GitRevTask" includeantruntime="true">
++ <classpath>
++ <pathelement location="${libbuild}/org.eclipse.jgit-1.1.0.201109151100-r.jar" />
++ </classpath>
++ </javac>
++ <jar destfile="${libbuild}/GitRevTask.jar" basedir="${libbuild}/GitRevTask">
++ <manifest>
++ <attribute name="Main-Class" value="GitRevTask"/>
++ </manifest>
++ </jar>
++ </target>
++
++ <target name="determineGitRevision" if="isGit" depends="buildGitRevTask">
++ <taskdef resource="GitRevTask.properties">
++ <classpath>
++ <pathelement location="${libbuild}/GitRevTask.jar" />
++ <pathelement location="${libbuild}/org.eclipse.jgit-1.1.0.201109151100-r.jar" />
++ </classpath>
++ </taskdef>
++ <gitRev repoPath="${yacyroot}" branchprop="branch" revprop="releaseNr" dateprop="DSTAMP" />
++ </target>
++
++ <!-- reading the build properties from file -->
++ <target name="readBuildProperties" depends="determineGitRevision">
++ <!-- loading some property values from file -->
++ <loadproperties srcFile="build.properties" />
++ </target>
++
++ <!-- initializing all needed variables -->
++ <target name="init" depends="readBuildProperties">
++ <mkdir dir="${data}"/>
++ <mkdir dir="${release}"/>
++
++ <!-- YaCy Release Date -->
++ <filter token="REPL_DATE" value="${DSTAMP}"/>
++ <filter token="REPL_RELEASE" value="${stdReleaseFile}"/>
++
++ <!-- YaCy Brach -->
++ <echo message="YaCy Branch: ${branch}" />
++
++ <!-- YaCy Release Version number -->
++ <echo message="YaCy Version number: ${releaseVersion}" />
++ <filter token="REPL_VERSION" value="${releaseVersion}" />
++
++ <!-- YaCy Release <revision number -->
++ <echo message="YaCy Release number: ${releaseNr}" />
++ <filter token="REPL_REVISION_NR" value="${releaseNr}"/>
++
++ <!-- YaCy root directory -->
++ <filter token="REPL_YACY_ROOT_DIR" value="${yacyroot}"/>
++ <filter token="REPL_PKGMANAGER" value="${PKGMANAGER}"/>
++ <filter token="REPL_RESTARTCMD" value="${RESTARTCMD}"/>
++
++ <!-- apply replacments -->
++ <delete file="${build}/net/yacy/peers/operation/yacyBuildProperties.java" failonerror="false"/>
++ <copy file="${src}/net/yacy/peers/operation/yacyBuildProperties.java" tofile="${build}/net/yacy/peers/operation/yacyBuildProperties.java" overwrite="true" filtering="true" />
++
++ <!-- copy log4j config file -->
++ <copy file="${src}/log4j.properties" tofile="${build}/log4j.properties" overwrite="true" filtering="true" />
++
++ </target>
++
++ <target name="javadoc" depends="init" description="make javadoc for YaCy core">
++ <javadoc destdir="${javadoc}"
++ windowtitle="YaCy API"
++ encoding="UTF-8"
++ charset="UTF-8"
++ access="private">
++ <fileset dir="${src}">
++ <include name="**/*.java"/>
++ </fileset>
++ </javadoc>
++ </target>
++
++ <!-- define the classpath that should be used for compiling -->
++ <!-- when changing paths here, please also update the paths in /addon/YaCy.app/Contents/Info.plist -->
++ <path id="project.class.path">
++ <pathelement location="${build}" />
++ <pathelement location="${htroot}" />
++ <pathelement location="${lib}/jetty-http-7.3.0.v20110203.jar" />
++ <pathelement location="${lib}/jetty-io-7.3.0.v20110203.jar" />
++ <pathelement location="${lib}/jetty-security-7.3.0.v20110203.jar" />
++ <pathelement location="${lib}/jetty-server-7.3.0.v20110203.jar" />
++ <pathelement location="${lib}/jetty-servlet-7.3.0.v20110203.jar" />
++ <pathelement location="${lib}/jetty-servlets-7.3.0.v20110203.jar" />
++ <pathelement location="${lib}/jetty-util-7.3.0.v20110203.jar" />
++ <pathelement location="${lib}/activation.jar" />
++ <pathelement location="${lib}/apache-mime4j-0.6.jar" />
++ <pathelement location="${lib}/arq-2.8.7.jar" />
++ <pathelement location="${lib}/bcmail-jdk15-145.jar" />
++ <pathelement location="${lib}/bcprov-jdk15-145.jar" />
++ <pathelement location="${lib}/commons-codec-1.7.jar" />
++ <pathelement location="${lib}/commons-compress-1.4.1.jar" />
++ <pathelement location="${lib}/commons-fileupload-1.2.2.jar" />
++ <pathelement location="${lib}/commons-io-2.1.jar" />
++ <pathelement location="${lib}/commons-jxpath-1.3.jar" />
++ <pathelement location="${lib}/commons-lang-2.6.jar" />
++ <pathelement location="${lib}/commons-logging-1.1.1.jar" />
++ <pathelement location="${lib}/fontbox-1.8.2.jar" />
++ <pathelement location="${lib}/geronimo-stax-api_1.0_spec-1.0.1.jar" />
++ <pathelement location="${lib}/guava-13.0.1.jar" />
++ <pathelement location="${lib}/htmllexer.jar" />
++ <pathelement location="${lib}/httpclient-4.2.5.jar" />
++ <pathelement location="${lib}/httpcore-4.2.4.jar" />
++ <pathelement location="${lib}/httpmime-4.2.5.jar" />
++ <pathelement location="${lib}/icu4j-core.jar" />
++ <pathelement location="${lib}/iri-0.8.jar" />
++ <pathelement location="${lib}/J7Zip-modified.jar" />
++ <pathelement location="${lib}/jakarta-oro-2.0.8.jar" />
++ <pathelement location="${lib}/jaudiotagger-2.0.4-20111207.115108-15.jar" />
++ <pathelement location="${lib}/jcifs-1.3.17.jar" />
++ <pathelement location="${lib}/jcl-over-slf4j-1.7.2.jar" />
++ <pathelement location="${lib}/jempbox-1.8.2" />
++ <pathelement location="${lib}/jena-2.6.4.jar" />
++ <pathelement location="${lib}/jsch-0.1.42.jar" />
++ <pathelement location="${lib}/json-simple-1.1.jar" />
++ <pathelement location="${lib}/jsoup-1.6.3.jar" />
++ <pathelement location="${lib}/log4j-over-slf4j-1.7.2.jar" />
++ <pathelement location="${lib}/lucene-analyzers-common-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-analyzers-phonetic-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-classification-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-codecs-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-core-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-facet-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-grouping-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-highlighter-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-join-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-memory-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-misc-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-queries-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-queryparser-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-spatial-4.4.0.jar" />
++ <pathelement location="${lib}/lucene-suggest-4.4.0.jar" />
++ <pathelement location="${lib}/metadata-extractor-2.6.2.jar" />
++ <pathelement location="${lib}/mysql-connector-java-5.1.12-bin.jar" />
++ <pathelement location="${lib}/noggit-0.5.jar" />
++ <pathelement location="${lib}/pdfbox-1.8.2.jar" />
++ <pathelement location="${lib}/poi-3.6-20091214.jar" />
++ <pathelement location="${lib}/poi-scratchpad-3.6-20091214.jar" />
++ <pathelement location="${lib}/sax-2.0.1.jar" />
++ <pathelement location="${lib}/servlet-api-2.5-20081211.jar" />
++ <pathelement location="${lib}/slf4j-api-1.7.2.jar" />
++ <pathelement location="${lib}/slf4j-jdk14-1.7.2.jar" />
++ <pathelement location="${lib}/solr-core-4.4.0.jar" />
++ <pathelement location="${lib}/solr-solrj-4.4.0.jar" />
++ <pathelement location="${lib}/spatial4j-0.3.jar" />
++ <pathelement location="${lib}/webcat-0.1-swf.jar" />
++ <pathelement location="${lib}/wstx-asl-3.2.9.jar" />
++ <pathelement location="${lib}/xercesImpl.jar" />
++ <pathelement location="${lib}/xml-apis.jar" />
++ <pathelement location="${lib}/zookeeper-3.4.5.jar" />
++ </path>
++
++ <target name="compile-core" depends="init" description="compile YaCy core">
++
++ <!-- compile yacyBuildProperties.java -->
++ <javac srcdir="${build}" destdir="${build}" sourcepath="${src}"
++ debug="true" debuglevel="lines,vars,source" includeantruntime="false"
++ includes="net/yacy/peers/operation/yacyBuildProperties.java"
++ source="${javacSource}" target="${javacTarget}">
++ <classpath refid="project.class.path" />
++ <compilerarg value="-Xlint"/>
++ </javac>
++ <delete file="${build}/BuildProperties.java" />
++
++ <!-- compile the core sources -->
++ <javac srcdir="${src}/" destdir="${build}"
++ debug="true" debuglevel="lines,vars,source" includeantruntime="false"
++ excludes="net/yacy/peers/operation/yacyBuildProperties.java"
++ source="${javacSource}" target="${javacTarget}">
++ <classpath refid="project.class.path" />
++ <compilerarg value="-Xlint"/>
++ </javac>
++
++ <!-- prepare classpath for MANIFEST (manifest cp is relative to jar) -->
++ <path id="project.classpath.runtime">
++ <fileset dir="./lib">
++ <include name="**/*.jar" />
++ <exclude name="yacycore.jar"/>
++ </fileset>
++ </path>
++ <pathconvert property="manifest.classpath" pathsep=" " refid="project.classpath.runtime">
++ <flattenmapper/>
++ </pathconvert>
++
++ <!-- make the jacycore jar -->
++ <jar destfile="${lib}/yacycore.jar" basedir="${build}/">
++ <manifest>
++ <attribute name="Main-Class" value="net.yacy.yacy"/>
++ <attribute name="Class-Path" value="${manifest.classpath}"/>
++ </manifest>
++ </jar>
++
++ </target>
++
++ <target name="compile-cora" depends="init" description="compile YaCy cora component">
++ <!-- compile the cora sources -->
++ <javac srcdir="${src}/net/yacy/cora/" destdir="${build}/"
++ debug="true" debuglevel="lines,vars,source"
++ source="${javacSource}" target="${javacTarget}">
++ <classpath refid="project.class.path" />
++ <compilerarg value="-Xlint"/>
++ </javac>
++
++ <!-- make yacy-cora.jar -->
++ <jar destfile="${lib}/yacy-cora.jar" includes="**/net/yacy/cora/**" basedir="${build}/"></jar>
++
++ </target>
++
++
++ <target name="compile" depends="compile-core" description="compile YaCy core and YaCy servlets">
++ <!-- compile htroot, htroot/yacy and htroot/htdocsdefault -->
++ <javac srcdir="${htroot}/"
++ excludes="processing/**"
++ source="${javacSource}" target="${javacTarget}"
++ debug="true" debuglevel="lines,vars,source" includeantruntime="false">
++ <classpath refid="project.class.path" />
++ <compilerarg value="-Xlint"/>
++ </javac>
++ </target>
++
++ <target name="all" depends="compile">
++ </target>
++
++ <target name="copyMain4Dist" depends="compile">
++ <!-- copy all libs -->
++ <copy todir="${release_main}/lib">
++ <fileset dir="${lib}"
++ includes="**/*"/>
++ </copy>
++
++ <!-- copy build libs -->
++ <copy todir="${release_main}/libbuild">
++ <fileset dir="${libbuild}"
++ includes="**/*"/>
++ </copy>
++
++ <!-- copy configuration files -->
++ <copy todir="${release_main}">
++ <fileset dir=".">
++ <include name="yacy.yellow"/>
++ <include name="yacy.badwords.example"/>
++ <include name="yacy.stopwords"/>
++ <include name="yacy.parser"/>
++ </fileset>
++ </copy>
++
++ <!-- copy defaults -->
++ <copy todir="${release_main}/defaults">
++ <fileset dir="${defaults}"
++ includes="**/*"/>
++ </copy>
++
++ <!-- copy Unix wrappers -->
++ <copy todir="${release_main}">
++ <fileset dir=".">
++ <include name="startYACY.sh"/>
++ <include name="stopYACY.sh"/>
++ <include name="killYACY.sh"/>
++ <include name="updateYACY.sh"/>
++ <include name="restart.sh"/>
++ <include name="reconfigureYACY.sh"/>
++ <include name="startYACY.command"/>
++ <include name="stopYACY.command"/>
++ </fileset>
++ </copy>
++
++ <!-- copy other wrappers -->
++ <copy todir="${release_main}">
++ <fileset dir=".">
++ <include name="startYACY.bat"/>
++ <include name="startYACY_debug.bat"/>
++ <include name="stopYACY.bat"/>
++ <include name="getWin32MaxHeap.bat"/>
++ </fileset>
++ </copy>
++
++ <!-- copy locales -->
++ <copy todir="${release_main}/locales">
++ <fileset dir="${locales}">
++ <include name="*"/>
++ </fileset>
++ </copy>
++
++ <!-- copy skins -->
++ <copy todir="${release_main}/skins">
++ <fileset dir="${skins}">
++ <include name="*"/>
++ </fileset>
++ </copy>
++
++ <!-- copy language statistics files -->
++ <copy todir="${release_main}/langstats">
++ <fileset dir="${langstats}">
++ <include name="*"/>
++ </fileset>
++ </copy>
++
++ <!-- copy documentation -->
++ <copy todir="${release_main}">
++ <fileset dir=".">
++ <include name="readme.txt"/>
++ <include name="gpl.txt"/>
++ <include name="ChangeLog"/>
++ <include name="AUTHORS"/>
++ <include name="COPYRIGHT"/>
++ <include name="NOTICE"/>
++ </fileset>
++ </copy>
++
++ <!-- copy source code -->
++ <copy todir="${release_main}/source">
++ <fileset dir="${src}">
++ <include name="**/*.*"/>
++ </fileset>
++ </copy>
++
++ <!-- copy server pages -->
++ <copy todir="${release_main}/htroot">
++ <fileset dir="${htroot}">
++ <include name="**/*"/>
++ </fileset>
++ </copy>
++
++ <!-- copy add-on's -->
++ <copy todir="${release_main}/addon">
++ <fileset dir="${addon}">
++ <include name="**/*"/>
++ </fileset>
++ </copy>
++
++ <!-- copy development tools -->
++ <copy todir="${release_main}">
++ <fileset dir=".">
++ <include name="build.xml"/>
++ <include name="build.properties"/>
++ </fileset>
++ </copy>
++
++ <!-- copy searchtest -->
++ <copy todir="${release_main}/bin">
++ <fileset dir="bin">
++ <include name="**/*.sh"/>
++ <include name="searchtest*"/>
++ </fileset>
++ </copy>
++
++ </target>
++
++ <!-- run unittests-->
++ <target name="compileTest" depends="compile" description="run unittests">
++ <javac srcdir="${test}" destdir="${test}"
++ debug="true" debuglevel="lines,vars,source"
++ source="${javacSource}" target="${javacTarget}">
++ <classpath>
++ <pathelement location="${build}"/>
++ <pathelement location="${htroot}"/>
++ <fileset dir="${libt}" includes="**/*.jar" />
++ <fileset dir="${lib}" includes="**/*.jar" />
++ </classpath>
++ <compilerarg value="-Xlint"/>
++ </javac>
++ </target>
++
++ <target name="test" depends="compileTest" description="run some unittests">
++ <junit printsummary="yes" haltonfailure="no" fork="true" dir="${yacyroot}">
++ <formatter type="plain"/>
++ <batchtest>
++ <fileset dir="${test}">
++ <include name="**/*Test*.java"/>
++ </fileset>
++ </batchtest>
++ <classpath>
++ <pathelement location="${test}"/>
++ <pathelement location="${build}"/>
++ <pathelement location="${htroot}"/>
++ <fileset dir="${libt}" includes="**/*.jar" />
++ <fileset dir="${lib}" includes="**/*.jar" />
++ </classpath>
++ </junit>
++ </target>
++
++ <!-- =======================================================================================================
++ making a release file for yacy
++ ======================================================================================================= -->
++
++ <target name="dist" depends="copyMain4Dist" description="make for standard YaCy">
++ <tar destfile="${release}/${stdReleaseFile}" compression="gzip" defaultexcludes="yes" longfile="fail">
++
++ <!-- packing all files into a gzipped tar -->
++ <tarfileset dir="${release_main}" prefix="${releaseFileParentDir}/" dirmode="${accessRightsDir}" mode="${accessRightsExecutable}">
++ <include name="**/*.sh"/>
++ <include name="**/*.command"/>
++ </tarfileset>
++ <tarfileset dir="${release_main}" prefix="${releaseFileParentDir}/" dirmode="${accessRightsDir}" mode="${accessRightsFile}" >
++ <include name="**/*"/>
++ <exclude name="**/*.sh"/>
++ <exclude name="**/*.command"/>
++ </tarfileset>
++ </tar>
++
++ <delete dir="${release_main}"/>
++ <delete dir="${release_windows}" failonerror="false" />
++ <delete dir="${release}/SPECS" failonerror="false" />
++ </target>
++
++ <!-- packing YaCy search widget for static hosting -->
++ <target name="portalsearch" description="pack YaCy search widget for static hosting">
++ <tar destfile="${release}/yacy-portalsearch.tar.gz" compression="gzip" defaultexcludes="yes" longfile="fail">
++ <tarfileset dir="${portalsearch}" prefix="yacy/portalsearch/">
++ <include name="*.*"/>
++ </tarfileset>
++ <tarfileset dir="${jquery}" prefix="yacy/jquery/">
++ <include name="**/*"/>
++ </tarfileset>
++ <tarfileset dir="${img-2}" prefix="yacy/ui/img-2/">
++ <include name="magnify.png"/>
++ <include name="cancel_round.png"/>
++ <include name="stop.png"/>
++ </tarfileset>
++ </tar>
++ </target>
++
++ <!-- make clean -->
++ <target name="clean" description="make clean">
++ <delete dir="${release_main}" failonerror="false"/>
++ <delete file="${build}/net/yacy/peers/operation/yacyBuildProperties.java" failonerror="false"/>
++ <delete file="${build}/log4j.properties" failonerror="false"/>
++ <delete file="${lib}/yacycore.jar" failonerror="false"/>
++ <delete file="${lib}/yacy-cora.jar" failonerror="false"/>
++ <delete file="${lib}/svnRevNr.jar" failonerror="false"/>
++ <delete file="${libbuild}/svnRevNr.jar" failonerror="false"/>
++ <delete file="${libbuild}/GitRevTask.jar" failonerror="false"/>
++ <delete failonerror="false">
++ <fileset dir="${src}" includes="**/*.class" />
++ <fileset dir="${build}" includes="**/*.class" />
++ <fileset dir="${htroot}" includes="**/*.class" />
++ <fileset dir="test/" includes="**/*.class" />
++ <fileset dir="${libbuild}/svnRevNr" includes="**/*.class" />
++ <fileset dir="${libbuild}/GitRevTask" includes="**/*.class" />
++ <fileset dir="." includes="TEST-*" />
++ </delete>
++ <delete dir="test/DATA" failonerror="false"/>
++ </target>
++
++ <target name="installonlinux">
++
++ <!-- copy configuration files -->
++ <copy todir="${DESTDIR}/usr/share/yacy">
++ <fileset dir=".">
++ <include name="yacy.logging"/>
++ <include name="yacy.yellow"/>
++ <include name="yacy.badwords.example"/>
++ <include name="yacy.stopwords"/>
++ <include name="yacy.parser"/>
++ <include name="httpd.mime"/>
++ </fileset>
++ </copy>
++
++ <!-- copy defaults -->
++ <copy todir="${DESTDIR}/usr/share/yacy/defaults">
++ <fileset dir="${defaults}" includes="**/*"/>
++ </copy>
++
++ <!-- copy locales -->
++ <copy todir="${DESTDIR}/usr/share/yacy/locales">
++ <fileset dir="${locales}">
++ <include name="*"/>
++ </fileset>
++ </copy>
++
++ <!-- copy skins -->
++ <copy todir="${DESTDIR}/usr/share/yacy/skins">
++ <fileset dir="${skins}">
++ <include name="*"/>
++ </fileset>
++ </copy>
++
++ <!-- copy language statistics files -->
++ <copy todir="${DESTDIR}/usr/share/yacy/langstats">
++ <fileset dir="${langstats}">
++ <include name="*"/>
++ </fileset>
++ </copy>
++
++ <!-- copy shell scripts from bin/ -->
++ <!-- i'm not sure, if this is consistent with the debian policy -->
++ <!-- but for /usr/bin or /usr/lib we need an extra environment variable -->
++ <copy todir="${DESTDIR}/usr/share/yacy/bin">
++ <fileset dir="bin/">
++ <include name="*"/>
++ </fileset>
++ </copy>
++ <chmod dir="${DESTDIR}/usr/share/yacy/bin/" perm="755" includes="*"/>
++
++ <!-- copy documentation -->
++ <copy todir="${DESTDIR}/usr/share/doc/yacy">
++ <fileset dir=".">
++ <include name="readme.txt"/>
++ <include name="ChangeLog"/>
++ <include name="AUTHORS"/>
++ <include name="COPYRIGHT"/>
++ <include name="NOTICE"/>
++ </fileset>
++ </copy>
++
++ <!-- copy server pages -->
++ <copy todir="${DESTDIR}/usr/share/yacy/htroot">
++ <fileset dir="${htroot}">
++ <include name="**/*"/>
++ <exclude name="yacy/seedUpload/**"/>
++ </fileset>
++ <fileset dir="${htroot}">
++ <include name="yacy/seedUpload/yacySeedUploadFile.html"/>
++ <include name="yacy/seedUpload/yacySeedUploadFtp.html"/>
++ </fileset>
++ </copy>
++
++ <!-- prepare /var/lib/yacy -->
++ <mkdir dir="${DESTDIR}/var/lib/yacy" />
++ <mkdir dir="${DESTDIR}/var/lib/yacy/LOG" />
++ <mkdir dir="${DESTDIR}/var/lib/yacy/SETTINGS" />
++ <mkdir dir="${DESTDIR}/etc" />
++ <mkdir dir="${DESTDIR}/var/log" />
++ <symlink link="${DESTDIR}/usr/share/yacy/DATA"
++ resource="../../../var/lib/yacy"/>
++ <symlink link="${DESTDIR}/etc/yacy"
++ resource="../var/lib/yacy/SETTINGS"/>
++ <symlink link="${DESTDIR}/var/log/yacy"
++ resource="../lib/yacy/LOG"/>
++
++ </target>
++
++ <!-- run YaCy (needed for NetBeans4) -->
++ <target name="run" description="Run YaCy">
++ <!-- debug options:
++ java -Xrunhprof:help
++ Hprof usage: -Xrunhprof[:help]|[:<option>=<value>, ...]
++
++ Option Name and Value Description Default
++ _____________________ ___________ _______
++ heap=dump|sites|all heap profiling all
++ cpu=samples|times|old CPU usage off
++ monitor=y|n monitor contention n
++ format=a|b ascii or binary output a
++ file=<file> write data to file java.hprof(.txt for ascii)
++ net=<host>:<port> send data over a socket write to file
++ depth=<size> stack trace depth 4
++ cutoff=<value> output cutoff point 0.0001
++ lineno=y|n line number in traces? y
++ thread=y|n thread in traces? n
++ doe=y|n dump on exit? y
++ gc_okay=y|n GC okay during sampling y
++
++ Example: java -Xrunhprof:cpu=samples,file=log.txt,depth=3 FooClass
++
++ Note: format=b cannot be used with cpu=old|times
++-->
++ <java classname="net.yacy.yacy" fork="yes">
++ <classpath>
++ <pathelement location="${build}"/>
++ <pathelement location="${htroot}"/>
++ <pathelement location="${lib}" />
++ <fileset dir="${lib}" includes="**/*.jar" />
++ </classpath>
++ <!--<arg value="-Xrunhprof"/>-->
++ <arg line="-start"/>
++ <jvmarg line="-Xms180m"/>
++ <jvmarg line="-Xmx512m"/>
++ <!-- <arg line="-migratewords"/>-->
++ <!-- <arg line="-start ${user.dir}"/>-->
++ </java>
++ </target>
++
++ <!-- run a single file (selected in NetBeans4) -->
++ <target name="run-single" depends="compile" description="Run Single File">
++ <fail unless="classname">Must set property 'classname'</fail>
++ <java classname="net.yacy.yacy" fork="yes">
++ <classpath refid="run.classpath"/>
++ <classpath>
++ <pathelement location="${build}"/>
++ <pathelement location="${htroot}"/>
++ <pathelement location="${lib}" />
++ <fileset dir="${lib}" includes="**/*.jar" />
++ </classpath>
++ <arg line=""/>
++ </java>
++ </target>
++
++ <!-- run YaCy with remote debugging enabled on port 8000 -->
++ <target name="debug" description="Debug YaCy">
++ <java classname="net.yacy.yacy" fork="yes">
++ <classpath>
++ <pathelement location="${build}"/>
++ <pathelement location="${htroot}"/>
++ <pathelement location="${lib}" />
++ <fileset dir="${lib}" includes="**/*.jar" />
++ </classpath>
++ <arg line="-start"/>
++ <jvmarg line="-Xdebug"/>
++ <jvmarg line="-Xnoagent"/>
++ <jvmarg line="-Djava.compiler=none"/>
++ <jvmarg line="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"/>
++ </java>
++ </target>
++
++ <!-- stop YaCy again -->
++ <target name="stop" description="Stop YaCy">
++ <java classname="net.yacy.yacy" fork="yes">
++ <classpath>
++ <pathelement location="${build}"/>
++ <pathelement location="${htroot}"/>
++ <pathelement location="${lib}" />
++ <fileset dir="${lib}" includes="**/*.jar" />
++ </classpath>
++ <arg line="-stop"/>
++ </java>
++ </target>
++
++
++ <!-- create the html-documentation from javadoc -->
++ <target name="create-doc" description="Create the javadoc-HTML-Pages">
++ <javadoc destdir="doc/api"
++ author="true"
++ version="true"
++ use="false"
++ encoding="iso-8859-1"
++ windowtitle="YaCy API Documentation">
++ <classpath>
++ <fileset dir="${lib}">
++ <include name="**/*.jar"/>
++ </fileset>
++ <pathelement location="${build}"/>
++ </classpath>
++ <fileset dir="source" defaultexcludes="yes">
++ <include name="**/*.java" />
++ </fileset>
++ <fileset dir="htroot" defaultexcludes="yes">
++ <include name="**/*.java" />
++ </fileset>
++ </javadoc>
++ </target>
++
++ <target name="rpm" depends="all" description="Creates the main rpm-package and another for lib">
++ <mkdir dir="${release}/RPMS/noarch" />
++ <mkdir dir="${release}/BUILD" />
++ <copy file="addon/yacy-svn-4.spec" tofile="${release}/SPECS/yacy-svn.spec" overwrite="true" filtering="true" />
++
++ <rpm specFile="yacy-svn.spec" topDir="${release}" />
++
++ <move file="${release}/RPMS/noarch/yacy-${releaseVersion}_${releaseNr}-3.noarch.rpm"
++ tofile="${release}/yacy-${releaseVersion}_${releaseNr}-3.noarch.rpm" />
++ <move file="${release}/RPMS/noarch/yacy-lib-${releaseVersion}_${releaseNr}-3.noarch.rpm"
++ tofile="${release}/yacy-lib-${releaseVersion}_${releaseNr}-3.noarch.rpm" />
++
++ <delete dir="${release}/SPECS" failonerror="false" />
++ <delete dir="${release}/RPMS" failonerror="false" />
++ <delete dir="${release_windows}" failonerror="false" />
++ </target>
++
++ <target name="distWinInstaller" depends="copyMain4Dist" description="Creates an NSIS Windows installer">
++ <!-- http://nsisant.sourceforge.net/ -->
++ <mkdir dir="${release_windows}" />
++ <copy file="build.nsi" tofile="${release_windows}/build.nsi" overwrite="true" filtering="true" />
++ <taskdef name="nsis" classname="net.sf.nsisant.Task">
++ <classpath location="${libbuild}/nsisant-1.2.jar"/>
++ </taskdef>
++ <nsis script="${release_windows}/build.nsi" nocd="yes" verbosity="2" />
++ <move file="${release_windows}/yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.exe"
++ tofile="${release}/yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.exe" />
++
++ <delete dir="${release_main}"/>
++ <delete dir="${release_windows}" failonerror="false" />
++ </target>
++
++ <target name="distMacApp" depends="copyMain4Dist" description="Creates a YaCy.app">
++ <copy todir="${release_mac}/YaCy.app">
++ <fileset dir="${addon}/YaCy.app"></fileset>
++ </copy>
++ <copy file="${addon}/YaCy.app/Contents/Info.plist" tofile="${release_mac}/YaCy.app/Contents/Info.plist" filtering="true" overwrite="true" />
++ <move file="${release_main}" tofile="${release_mac}/YaCy.app/Contents/Resources/Java" verbose="false" />
++ <chmod file="${release_mac}/YaCy.app/Contents/MacOS/JavaApplicationStub" perm="755"/>
++ <exec executable="hdiutil">
++ <arg line="create -srcfolder ${release_mac}/YaCy.app ${release}/yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.dmg"/>
++ </exec>
++ <delete dir="${release_mac}" failonerror="false" verbose="false" />
++ </target>
++
++ <!-- to use the deb command the following debian packages must be installed: dpkg-dev debhelper m4 -->
++ <target name="deb" depends="init" description="Creates a debian package">
++ <!-- replacing the old with the new revision number -->
++ <replaceregexp file="debian/changelog"
++ match="yacy \(.*\) unstable; urgency=low"
++ replace="yacy (${releaseVersion}.${releaseNr}) unstable; urgency=low" />
++
++ <!-- build debian package -->
++ <exec executable="dpkg-buildpackage">
++ <arg value="-b"/>
++ <arg value="-rfakeroot"/>
++ <arg value="-uc"/>
++ </exec>
++ <replaceregexp file="debian/changelog"
++ match="yacy \(.*\) unstable; urgency=low"
++ replace="yacy (*auto-git-version*) unstable; urgency=low" />
++ </target>
++
++ <target name="sign" depends="readBuildProperties" description="sign current release file in RELEASE/ with ${privateKeyFile}">
++ <fail message="There is no release file (${release}/${stdReleaseFile}) that could be signed !">
++ <condition>
++ <not><available file="${stdReleaseFile}" filepath="${release}" type="file" /></not>
++ </condition>
++ </fail>
++ <java classname="net.yacy.utils.CryptoLib" failonerror="true">
++ <classpath>
++ <pathelement location="${build}"/>
++ </classpath>
++ <arg line="--sign ${privateKeyFile} ${release}/${stdReleaseFile}"/>
++ </java>
++ </target>
++
++ <target name="genkey" depends="readBuildProperties" description="generate a pair of keys and write it to ${privateKeyFile} and ${privateKeyFile}.pub">
++ <fail message="There is already a private key file (${privateKeyFile})!">
++ <condition>
++ <available file="${privateKeyFile}" type="file" />
++ </condition>
++ </fail>
++ <java classname="net.yacy.utils.CryptoLib" failonerror="true">
++ <classpath>
++ <pathelement location="${build}"/>
++ </classpath>
++ <arg line="--gen-key ${privateKeyFile} ${privateKeyFile}.pub"/>
++ </java>
++ <chmod file="${privateKeyFile}" perm="600"/>
++ </target>
++
++ <target name="deleteData" description="start with a fresh yacy installation">
++ <delete dir="${data}"/>
++ </target>
++</project>
diff --cc source/net/yacy/yacy.java
index 56d5340f2,02c58ba76..76644da07
--- a/source/net/yacy/yacy.java
+++ b/source/net/yacy/yacy.java
@@@ -1,1080 -1,697 +1,1080 @@@
-// yacy.java
-// -----------------------
-// (C) by Michael Peter Christen; [email protected]
-// first published on http://www.yacy.net
-// Frankfurt, Germany, 2004, 2005
-//
-// $LastChangedDate$
-// $LastChangedRevision$
-// $LastChangedBy$
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-package net.yacy;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.RandomAccessFile;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
-import java.util.Properties;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.ExecutionException;
-
-import net.yacy.cora.date.GenericFormatter;
-import net.yacy.cora.lod.JenaTripleStore;
-import net.yacy.cora.protocol.ClientIdentification;
-import net.yacy.cora.protocol.RequestHeader;
-import net.yacy.cora.protocol.TimeoutRequest;
-import net.yacy.cora.protocol.http.HTTPClient;
-import net.yacy.cora.sorting.Array;
-import net.yacy.cora.util.ConcurrentLog;
-import net.yacy.data.Translator;
-import net.yacy.gui.YaCyApp;
-import net.yacy.gui.framework.Browser;
-import net.yacy.kelondro.util.FileUtils;
-import net.yacy.kelondro.util.Formatter;
-import net.yacy.kelondro.util.MemoryControl;
-import net.yacy.kelondro.util.OS;
-import net.yacy.peers.operation.yacyBuildProperties;
-import net.yacy.peers.operation.yacyRelease;
-import net.yacy.peers.operation.yacyVersion;
-import net.yacy.search.Switchboard;
-import net.yacy.search.SwitchboardConstants;
-import net.yacy.server.serverCore;
-import net.yacy.server.http.HTTPDemon;
-
-import com.google.common.io.Files;
-
-
-/**
-* This is the main class of YaCy. Several threads are started from here:
-* <ul>
-* <li>one single instance of the plasmaSwitchboard is generated, which itself
-* starts a thread with a plasmaHTMLCache object. This object simply counts
-* files sizes in the cache and terminates them. It also generates a
-* plasmaCrawlerLoader object, which may itself start some more httpc-calling
-* threads to load web pages. They terminate automatically when a page has
-* loaded.
-* <li>one serverCore - thread is started, which implements a multi-threaded
-* server. The process may start itself many more processes that handle
-* connections.lo
-* <li>finally, all idle-dependent processes are written in a queue in
-* plasmaSwitchboard which are worked off inside an idle-sensitive loop of the
-* main process. (here)
-* </ul>
-*
-* On termination, the following must be done:
-* <ul>
-* <li>stop feeding of the crawling process because it otherwise fills the
-* indexing queue.
-* <li>say goodbye to connected peers and disable new connections. Don't wait for
-* success.
-* <li>first terminate the serverCore thread. This prevents that new cache
-* objects are queued.
-* <li>wait that the plasmaHTMLCache terminates (it should be normal that this
-* process already has terminated).
-* <li>then wait for termination of all loader process of the
-* plasmaCrawlerLoader.
-* <li>work off the indexing and cache storage queue. These values are inside a
-* RAM cache and would be lost otherwise.
-* <li>write all settings.
-* <li>terminate.
-* </ul>
-*/
-
-public final class yacy {
-
- // static objects
- public static final String vString = yacyBuildProperties.getVersion();
- public static float version = 0.1f;
-
- public static final String vDATE = yacyBuildProperties.getBuildDate();
- public static final String copyright = "[ YaCy v" + vString + ", build " + vDATE + " by Michael Christen / www.yacy.net ]";
- public static final String hline = "-------------------------------------------------------------------------------";
- public static final Semaphore shutdownSemaphore = new Semaphore(0);
-
- /**
- * a reference to the {@link Switchboard} created by the
- * {@link yacy#startup(String, long, long)} method.
- */
- private static Switchboard sb = null;
- public static String homedir;
- public static File dataHome_g;
-
- /**
- * Starts up the whole application. Sets up all datastructures and starts
- * the main threads.
- *
- * @param homePath Root-path where all information is to be found.
- * @param startupFree free memory at startup time, to be used later for statistics
- */
- private static void startup(final File dataHome, final File appHome, final long startupMemFree, final long startupMemTotal, final boolean gui) {
- try {
- // start up
- System.out.println(copyright);
- System.out.println(hline);
-
- // check java version
- try {
- "a".isEmpty(); // needs at least Java 1.6
- } catch (final NoSuchMethodError e) {
- System.err.println("STARTUP: Java Version too low. You need at least Java 1.6 to run YaCy");
- System.exit(-1);
- }
-
- // ensure that there is a DATA directory, if not, create one and if that fails warn and die
- mkdirsIfNeseccary(dataHome);
- dataHome_g = dataHome;
- mkdirsIfNeseccary(appHome);
- File f = new File(dataHome, "DATA/");
- mkdirsIfNeseccary(f);
- if (!(f.exists())) {
- System.err.println("Error creating DATA-directory in " + dataHome.toString() + " . Please check your write-permission for this folder. YaCy will now terminate.");
- System.exit(-1);
- }
-
- homedir = appHome.toString();
-
- // setting up logging
- f = new File(dataHome, "DATA/LOG/");
- mkdirsIfNeseccary(f);
- f = new File(dataHome, "DATA/LOG/yacy.logging");
- final File f0 = new File(appHome, "defaults/yacy.logging");
- if (!f.exists() || f0.lastModified() > f.lastModified()) try {
- Files.copy(f0, f);
- } catch (final IOException e){
- System.out.println("could not copy yacy.logging");
- }
- try{
- ConcurrentLog.configureLogging(dataHome, appHome, new File(dataHome, "DATA/LOG/yacy.logging"));
- } catch (final IOException e) {
- System.out.println("could not find logging properties in homePath=" + dataHome);
- ConcurrentLog.logException(e);
- }
- ConcurrentLog.config("STARTUP", "YaCy version: " + yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision());
- ConcurrentLog.config("STARTUP", "Java version: " + System.getProperty("java.version", "no-java-version"));
- ConcurrentLog.config("STARTUP", "Operation system: " + System.getProperty("os.name","unknown"));
- ConcurrentLog.config("STARTUP", "Application root-path: " + appHome);
- ConcurrentLog.config("STARTUP", "Data root-path: " + dataHome);
- ConcurrentLog.config("STARTUP", "Time zone: UTC" + GenericFormatter.UTCDiffString() + "; UTC+0000 is " + System.currentTimeMillis());
- ConcurrentLog.config("STARTUP", "Maximum file system path length: " + OS.maxPathLength);
-
- f = new File(dataHome, "DATA/yacy.running");
- final String conf = "DATA/SETTINGS/yacy.conf".replace("/", File.separator);
- if (f.exists()) { // another instance running? VM crash? User will have to care about this
- ConcurrentLog.severe("STARTUP", "WARNING: the file " + f + " exists, this usually means that a YaCy instance is still running. If you want to restart YaCy, try first ./stopYACY.sh, then ./startYACY.sh. If ./stopYACY.sh fails, try ./killYACY.sh");
-
- // If YaCy is actually running, then we check if the server port is open.
- // If yes, then we consider that a restart is a user mistake and then we just respond
- // as the user expects and tell the browser to open the start page.
- // That will especially happen if Windows Users double-Click the YaCy Icon on the desktop to simply
- // open the web interface. (They don't think of 'servers' they just want to get to the search page).
- // We need to parse the configuration file for that to get the host port
- File dataFile = new File(dataHome, conf);
- if (dataFile.exists()) {
- Properties p = new Properties();
- p.load(new FileInputStream(dataFile));
- int port = Integer.parseInt(p.getProperty("port", "8090"));
- try {
- if (TimeoutRequest.ping("127.0.0.1", port, 1000)) {
- Browser.openBrowser("http://localhost:" + port + "/" + p.getProperty(SwitchboardConstants.BROWSER_POP_UP_PAGE, "index.html"));
- // Thats it; YaCy was running, the user is happy, we can stop now.
- ConcurrentLog.severe("STARTUP", "WARNING: YaCy instance was still running; just opening the browser and exit.");
- System.exit(0);
- }
- } catch (final ExecutionException ex) {
- ConcurrentLog.info("STARTUP", "INFO: delete old yacy.running file; likely previous YaCy session was not orderly shutdown!");
- }
- }
-
- // YaCy is not running; thus delete the file an go on as nothing was wrong.
- delete(f);
- }
- if (!f.createNewFile()) ConcurrentLog.severe("STARTUP", "WARNING: the file " + f + " can not be created!");
- try { new FileOutputStream(f).write(Integer.toString(OS.getPID()).getBytes()); } catch (final Exception e) { } // write PID
- f.deleteOnExit();
- FileChannel channel = null;
- FileLock lock = null;
- try {
- channel = new RandomAccessFile(f,"rw").getChannel();
- lock = channel.tryLock(); // lock yacy.running
- } catch (final Exception e) { }
-
- try {
- sb = new Switchboard(dataHome, appHome, "defaults/yacy.init".replace("/", File.separator), conf);
- } catch (final RuntimeException e) {
- ConcurrentLog.severe("STARTUP", "YaCy cannot start: " + e.getMessage(), e);
- System.exit(-1);
- }
- //sbSync.V(); // signal that the sb reference was set
-
- // switch the memory strategy
- MemoryControl.setStandardStrategy(sb.getConfigBool("memory.standardStrategy", true));
-
- // save information about available memory at startup time
- sb.setConfig("memoryFreeAfterStartup", startupMemFree);
- sb.setConfig("memoryTotalAfterStartup", startupMemTotal);
-
- // start gui if wanted
- if (gui) YaCyApp.start("localhost", (int) sb.getConfigLong("port", 8090));
-
- // hardcoded, forced, temporary value-migration
- sb.setConfig("htTemplatePath", "htroot/env/templates");
-
- int oldRev;
- try {
- oldRev = Integer.parseInt(sb.getConfig("svnRevision", "0"));
- } catch (final NumberFormatException e) {
- oldRev = 0;
- }
- final int newRev = Integer.parseInt(yacyBuildProperties.getSVNRevision());
- sb.setConfig("svnRevision", yacyBuildProperties.getSVNRevision());
- sb.setConfig("applicationRoot", appHome.toString());
- sb.setConfig("dataRoot", dataHome.toString());
- yacyVersion.latestRelease = version;
-
- // read environment
- final int timeout = Math.max(5000, Integer.parseInt(sb.getConfig("httpdTimeout", "5000")));
-
- // create some directories
- final File htRootPath = new File(appHome, sb.getConfig("htRootPath", "htroot"));
- final File htDocsPath = sb.getDataPath(SwitchboardConstants.HTDOCS_PATH, SwitchboardConstants.HTDOCS_PATH_DEFAULT);
- mkdirIfNeseccary(htDocsPath);
- //final File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));
-
- // create default notifier picture
- //TODO: Use templates instead of copying images ...
- if (!((new File(htDocsPath, "notifier.gif")).exists())) try {
- Files.copy(new File(htRootPath, "env/grafics/empty.gif"),
- new File(htDocsPath, "notifier.gif"));
- } catch (final IOException e) {}
-
- final File htdocsReadme = new File(htDocsPath, "readme.txt");
- if (!(htdocsReadme.exists())) try {FileUtils.copy((
- "This is your root directory for individual Web Content\r\n" +
- "\r\n" +
- "Please place your html files into the www subdirectory.\r\n" +
- "The URL of that path is either\r\n" +
- "http://www.<your-peer-name>.yacy or\r\n" +
- "http://<your-ip>:<your-port>/www\r\n" +
- "\r\n" +
- "Other subdirectories may be created; they map to corresponding sub-domains.\r\n" +
- "This directory shares it's content with the applications htroot path, so you\r\n" +
- "may access your yacy search page with\r\n" +
- "http://<your-peer-name>.yacy/\r\n" +
- "\r\n").getBytes(), htdocsReadme);} catch (final IOException e) {
- System.out.println("Error creating htdocs readme: " + e.getMessage());
- }
-
- final File wwwDefaultPath = new File(htDocsPath, "www");
- mkdirIfNeseccary(wwwDefaultPath);
-
-
- final File shareDefaultPath = new File(htDocsPath, "share");
- mkdirIfNeseccary(shareDefaultPath);
-
- migration.migrate(sb, oldRev, newRev);
-
- // delete old release files
- final int deleteOldDownloadsAfterDays = (int) sb.getConfigLong("update.deleteOld", 30);
- yacyRelease.deleteOldDownloads(sb.releasePath, deleteOldDownloadsAfterDays );
-
- // set user-agent
- HTTPClient.setDefaultUserAgent(ClientIdentification.yacyInternetCrawlerAgent.userAgent);
-
- // initial fill of the triplestore
- File triplestore = new File(sb.getConfig("triplestore", new File(dataHome, "DATA/TRIPLESTORE").getAbsolutePath()));
- mkdirIfNeseccary(triplestore);
- for (String s: triplestore.list()) {
- if ((s.endsWith(".rdf") || s.endsWith(".nt")) && !s.equals("local.rdf") && !s.endsWith("_triplestore.rdf") && !s.startsWith("private_store_")) {
- try {
- JenaTripleStore.load(new File(triplestore, s).getAbsolutePath());
- } catch (final IOException e) {
- ConcurrentLog.logException(e);
- }
- }
- }
- if (sb.getConfigBool("triplestore.persistent", false)) {
- File local = new File(triplestore, "local.rdf");
- if (local.exists()) {
- try {
- JenaTripleStore.load(local.getAbsolutePath());
- } catch (final IOException e) {
- ConcurrentLog.logException(e);
- }
- }
- }
-
- // start main threads
- final String port = sb.getConfig("port", "8090");
- try {
- final HTTPDemon protocolHandler = new HTTPDemon(sb);
- final serverCore server = new serverCore(
- timeout /*control socket timeout in milliseconds*/,
- true /* block attacks (wrong protocol) */,
- protocolHandler /*command class*/,
- sb,
- 30000 /*command max length incl. GET args*/);
- server.setName("httpd:"+port);
- server.setPriority(Thread.MAX_PRIORITY);
- server.setObeyIntermission(false);
-
- // start the server
- sb.deployThread("10_httpd", "HTTPD Server/Proxy", "the HTTPD, used as web server and proxy", null, server, 0, 0, 0, 0);
- //server.start();
-
- // open the browser window
- final boolean browserPopUpTrigger = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
- if (browserPopUpTrigger) try {
- final String browserPopUpPage = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
- //boolean properPW = (sb.getConfig("adminAccount", "").isEmpty()) && (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0);
- //if (!properPW) browserPopUpPage = "ConfigBasic.html";
- Browser.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage);
- } catch (final Throwable e) {
- // cannot open browser. This may be normal in headless environments
- //Log.logException(e);
- }
-
- // enable browser popup, http server is ready now
- sb.tray.setReady();
-
- //regenerate Locales from Translationlist, if needed
- final File locale_source = sb.getAppPath("locale.source", "locales");
- final String lang = sb.getConfig("locale.language", "");
- if (!lang.equals("") && !lang.equals("default")) { //locale is used
- String currentRev = "";
- try{
- final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(sb.getDataPath("locale.translated_html", "DATA/LOCALE/htroot"), lang+"/version" ))));
- currentRev = br.readLine();
- br.close();
- }catch(final IOException e){
- //Error
- }
-
- if (!currentRev.equals(sb.getConfig("svnRevision", ""))) try { //is this another version?!
- final File sourceDir = new File(sb.getConfig("htRootPath", "htroot"));
- final File destDir = new File(sb.getDataPath("locale.translated_html", "DATA/LOCALE/htroot"), lang);
- if (Translator.translateFilesRecursive(sourceDir, destDir, new File(locale_source, lang + ".lng"), "html,template,inc", "locale")){ //translate it
- //write the new Versionnumber
- final BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(new File(destDir, "version"))));
- bw.write(sb.getConfig("svnRevision", "Error getting Version"));
- bw.close();
- }
- } catch (final IOException e) {}
- }
- // initialize number formatter with this locale
- Formatter.setLocale(lang);
-
- // registering shutdown hook
- ConcurrentLog.config("STARTUP", "Registering Shutdown Hook");
- final Runtime run = Runtime.getRuntime();
- run.addShutdownHook(new shutdownHookThread(Thread.currentThread(), sb));
-
- // save information about available memory after all initializations
- //try {
- sb.setConfig("memoryFreeAfterInitBGC", MemoryControl.free());
- sb.setConfig("memoryTotalAfterInitBGC", MemoryControl.total());
- System.gc();
- sb.setConfig("memoryFreeAfterInitAGC", MemoryControl.free());
- sb.setConfig("memoryTotalAfterInitAGC", MemoryControl.total());
- //} catch (final ConcurrentModificationException e) {}
-
- // wait for server shutdown
- try {
- sb.waitForShutdown();
- } catch (final Exception e) {
- ConcurrentLog.severe("MAIN CONTROL LOOP", "PANIC: " + e.getMessage(),e);
- }
- // shut down
- Array.terminate();
- ConcurrentLog.config("SHUTDOWN", "caught termination signal");
- server.terminate(false);
- server.interrupt();
- server.close();
-
- // idle until the processes are down
- if (server.isAlive()) {
- server.interrupt();
- }
- ConcurrentLog.config("SHUTDOWN", "server has terminated");
- sb.close();
- } catch (final Exception e) {
- ConcurrentLog.severe("STARTUP", "Unexpected Error: " + e.getClass().getName(),e);
- //System.exit(1);
- }
- if(lock != null) lock.release();
- if(channel != null) channel.close();
- } catch (final Exception ee) {
- ConcurrentLog.severe("STARTUP", "FATAL ERROR: " + ee.getMessage(),ee);
- } finally {
- }
-
- // save the triple store
- if (sb.getConfigBool("triplestore.persistent", false)) {
- JenaTripleStore.saveAll();
- }
-
- ConcurrentLog.config("SHUTDOWN", "goodbye. (this is the last line)");
- ConcurrentLog.shutdown();
- shutdownSemaphore.release(1000);
- try {
- System.exit(0);
- } catch (final Exception e) {} // was once stopped by de.anomic.net.ftpc$sm.checkExit(ftpc.java:1790)
- }
-
- /**
- * @param f
- */
- private static void delete(final File f) {
- if(!f.delete())
- ConcurrentLog.severe("STARTUP", "WARNING: the file " + f + " can not be deleted!");
- }
-
- /**
- * @see File#mkdir()
- * @param path
- */
- private static void mkdirIfNeseccary(final File path) {
- if (!(path.exists()))
- if(!path.mkdir())
- ConcurrentLog.warn("STARTUP", "could not create directory "+ path.toString());
- }
-
- /**
- * @see File#mkdirs()
- * @param path
- */
- public static void mkdirsIfNeseccary(final File path) {
- if (!(path.exists()))
- if(!path.mkdirs())
- ConcurrentLog.warn("STARTUP", "could not create directories "+ path.toString());
- }
-
- /**
- * Loads the configuration from the data-folder.
- * FIXME: Why is this called over and over again from every method, instead
- * of setting the configurationdata once for this class in main?
- *
- * @param mes Where are we called from, so that the errormessages can be
- * more descriptive.
- * @param homePath Root-path where all the information is to be found.
- * @return Properties read from the configurationfile.
- */
- private static Properties configuration(final String mes, final File homePath) {
- ConcurrentLog.config(mes, "Application Root Path: " + homePath.toString());
-
- // read data folder
- final File dataFolder = new File(homePath, "DATA");
- if (!(dataFolder.exists())) {
- ConcurrentLog.severe(mes, "Application was never started or root path wrong.");
- System.exit(-1);
- }
-
- final Properties config = new Properties();
- FileInputStream fis = null;
- try {
- fis = new FileInputStream(new File(homePath, "DATA/SETTINGS/yacy.conf"));
- config.load(fis);
- } catch (final FileNotFoundException e) {
- ConcurrentLog.severe(mes, "could not find configuration file.");
- System.exit(-1);
- } catch (final IOException e) {
- ConcurrentLog.severe(mes, "could not read configuration file.");
- System.exit(-1);
- } finally {
- if(fis != null) {
- try {
- fis.close();
- } catch (final IOException e) {
- ConcurrentLog.logException(e);
- }
- }
- }
-
- return config;
- }
-
- /**
- * Call the shutdown-page of YaCy to tell it to shut down. This method is
- * called if you start yacy with the argument -shutdown.
- *
- * @param homePath Root-path where all the information is to be found.
- */
- public static void shutdown(final File homePath) {
- // start up
- System.out.println(copyright);
- System.out.println(hline);
- submitURL(homePath, "Steering.html?shutdown=", "Terminate YaCy");
- }
-
- public static void update(final File homePath) {
- // start up
- System.out.println(copyright);
- System.out.println(hline);
- submitURL(homePath, "ConfigUpdate_p.html?autoUpdate=", "Update YaCy to most recent version");
- }
-
- private static void submitURL(final File homePath, final String path, final String processdescription) {
- final Properties config = configuration("COMMAND-STEERING", homePath);
-
- // read port
- final int port = serverCore.getPortNr(config.getProperty("port", "8090"));
-
- // read password
- String encodedPassword = (String) config.get(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5);
- if (encodedPassword == null) encodedPassword = ""; // not defined
-
- // send 'wget' to web interface
- final RequestHeader requestHeader = new RequestHeader();
- requestHeader.put(RequestHeader.AUTHORIZATION, "realm=" + encodedPassword); // for http-authentify
-// final Client con = new Client(10000, requestHeader);
- final HTTPClient con = new HTTPClient(ClientIdentification.yacyInternetCrawlerAgent);
- con.setHeader(requestHeader.entrySet());
-// ResponseContainer res = null;
- try {
-// res = con.GET("http://localhost:"+ port +"/" + path);
- con.GETbytes("http://localhost:"+ port +"/" + path);
-
- // read response
-// if (res.getStatusLine().startsWith("2")) {
- if (con.getStatusCode() > 199 && con.getStatusCode() < 300) {
- ConcurrentLog.config("COMMAND-STEERING", "YACY accepted steering command: " + processdescription);
-// final ByteArrayOutputStream bos = new ByteArrayOutputStream(); //This is stream is not used???
-// try {
-// FileUtils.copyToStream(new BufferedInputStream(res.getDataAsStream()), new BufferedOutputStream(bos));
-// } finally {
-// res.closeStream();
-// }
- } else {
-// Log.logSevere("COMMAND-STEERING", "error response from YACY socket: " + res.getStatusLine());
- ConcurrentLog.severe("COMMAND-STEERING", "error response from YACY socket: " + con.getHttpResponse().getStatusLine());
- System.exit(-1);
- }
- } catch (final IOException e) {
- ConcurrentLog.severe("COMMAND-STEERING", "could not establish connection to YACY socket: " + e.getMessage());
- System.exit(-1);
-// } finally {
-// // release connection
-// if(res != null) {
-// res.closeStream();
-// }
- }
-
- try {
- HTTPClient.closeConnectionManager();
- } catch (final InterruptedException e) {
- e.printStackTrace();
- }
-
- // finished
- ConcurrentLog.config("COMMAND-STEERING", "SUCCESSFULLY FINISHED COMMAND: " + processdescription);
- }
-
- /**
- * Main-method which is started by java. Checks for special arguments or
- * starts up the application.
- *
- * @param args
- * Given arguments from the command line.
- */
- public static void main(String args[]) {
-
- try {
-
- // check assertion status
- //ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
- boolean assertionenabled = false;
- assert (assertionenabled = true) == true; // compare to true to remove warning: "Possible accidental assignement"
- if (assertionenabled) System.out.println("Asserts are enabled");
-
- // check memory amount
- System.gc();
- final long startupMemFree = MemoryControl.free();
- final long startupMemTotal = MemoryControl.total();
-
- // maybe go into headless awt mode: we have three cases depending on OS and one exception:
- // windows : better do not go into headless mode
- // mac : go into headless mode because an application is shown in gui which may not be wanted
- // linux : go into headless mode because this does not need any head operation
- // exception : if the -gui option is used then do not go into headless mode since that uses a gui
- boolean headless = true;
- if (OS.isWindows) headless = false;
- if (args.length >= 1 && args[0].toLowerCase().equals("-gui")) headless = false;
- System.setProperty("java.awt.headless", headless ? "true" : "false");
- System.setProperty("java.net.preferIPv4Stack", "true");
-
- String s = ""; for (final String a: args) s += a + " ";
- yacyRelease.startParameter = s.trim();
-
- File applicationRoot = new File(System.getProperty("user.dir").replace('\\', '/'));
- File dataRoot = applicationRoot;
- //System.out.println("args.length=" + args.length);
- //System.out.print("args=["); for (int i = 0; i < args.length; i++) System.out.print(args[i] + ", "); System.out.println("]");
- if ((args.length >= 1) && (args[0].toLowerCase().equals("-startup") || args[0].equals("-start"))) {
- // normal start-up of yacy
- if (args.length > 1) dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
- startup(dataRoot, applicationRoot, startupMemFree, startupMemTotal, false);
- } else if (args.length >= 1 && args[0].toLowerCase().equals("-gui")) {
- // start-up of yacy with gui
- if (args.length > 1) dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
- startup(dataRoot, applicationRoot, startupMemFree, startupMemTotal, true);
- } else if ((args.length >= 1) && ((args[0].toLowerCase().equals("-shutdown")) || (args[0].equals("-stop")))) {
- // normal shutdown of yacy
- if (args.length == 2) applicationRoot= new File(args[1]);
- shutdown(applicationRoot);
- } else if ((args.length >= 1) && (args[0].toLowerCase().equals("-update"))) {
- // aut-update yacy
- if (args.length == 2) applicationRoot= new File(args[1]);
- update(applicationRoot);
- } else if ((args.length >= 1) && (args[0].toLowerCase().equals("-version"))) {
- // show yacy version
- System.out.println(copyright);
- } else {
- if (args.length == 1) applicationRoot= new File(args[0]);
- startup(dataRoot, applicationRoot, startupMemFree, startupMemTotal, false);
- }
- } finally {
- ConcurrentLog.shutdown();
- }
- }
-}
-
-/**
-* This class is a helper class whose instance is started, when the java virtual
-* machine shuts down. Signals the plasmaSwitchboard to shut down.
-*/
-class shutdownHookThread extends Thread {
- private final Switchboard sb;
- private final Thread mainThread;
-
- public shutdownHookThread(final Thread mainThread, final Switchboard sb) {
- super();
- this.sb = sb;
- this.mainThread = mainThread;
- }
-
- @Override
- public void run() {
- try {
- if (!this.sb.isTerminated()) {
- ConcurrentLog.config("SHUTDOWN","Shutdown via shutdown hook.");
-
- // sending the yacy main thread a shutdown signal
- ConcurrentLog.fine("SHUTDOWN","Signaling shutdown to the switchboard.");
- this.sb.terminate("shutdown hook");
-
- // waiting for the yacy thread to finish execution
- ConcurrentLog.fine("SHUTDOWN","Waiting for main thread to finish.");
- if (this.mainThread.isAlive() && !this.sb.isTerminated()) {
- this.mainThread.join();
- }
- }
- } catch (final Exception e) {
- ConcurrentLog.severe("SHUTDOWN","Unexpected error. " + e.getClass().getName(),e);
- }
- }
-}
+package net.yacy;
+// yacy.java
+// -----------------------
+// (C) by Michael Peter Christen; [email protected]
+// first published on http://www.yacy.net
+// Frankfurt, Germany, 2004, 2005
+//
+// $LastChangedDate$
+// $LastChangedRevision$
+// $LastChangedBy$
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+//import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.Semaphore;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import net.yacy.cora.date.GenericFormatter;
+import net.yacy.cora.document.ASCII;
+import net.yacy.cora.document.UTF8;
+import net.yacy.cora.lod.JenaTripleStore;
+import net.yacy.cora.protocol.ClientIdentification;
+import net.yacy.cora.protocol.RequestHeader;
+import net.yacy.cora.protocol.http.HTTPClient;
+import net.yacy.cora.sorting.Array;
+import net.yacy.cora.sorting.OrderedScoreMap;
+import net.yacy.cora.sorting.ScoreMap;
+import net.yacy.gui.YaCyApp;
+import net.yacy.gui.framework.Browser;
+import net.yacy.http.HttpServer;
+import net.yacy.kelondro.blob.MapDataMining;
+import net.yacy.kelondro.data.meta.URIMetadataRow;
+import net.yacy.kelondro.data.word.Word;
+import net.yacy.kelondro.data.word.WordReference;
+import net.yacy.kelondro.logging.Log;
+import net.yacy.kelondro.order.Base64Order;
+import net.yacy.kelondro.rwi.Reference;
+import net.yacy.kelondro.rwi.ReferenceContainer;
+import net.yacy.kelondro.util.FileUtils;
+import net.yacy.kelondro.util.Formatter;
+import net.yacy.kelondro.util.MemoryControl;
+import net.yacy.kelondro.util.OS;
+import net.yacy.peers.SeedDB;
+import net.yacy.peers.operation.yacyBuildProperties;
+import net.yacy.peers.operation.yacyRelease;
+import net.yacy.peers.operation.yacyVersion;
+import net.yacy.search.Switchboard;
+import net.yacy.search.SwitchboardConstants;
+import net.yacy.search.index.MetadataRepository;
+import net.yacy.search.index.Segment;
+
+import com.google.common.io.Files;
+
+import de.anomic.data.Translator;
+import de.anomic.server.serverCore;
+import de.anomic.tools.enumerateFiles;
+
+/**
+* This is the main class of YaCy. Several threads are started from here:
+* <ul>
+* <li>one single instance of the plasmaSwitchboard is generated, which itself
+* starts a thread with a plasmaHTMLCache object. This object simply counts
+* files sizes in the cache and terminates them. It also generates a
+* plasmaCrawlerLoader object, which may itself start some more httpc-calling
+* threads to load web pages. They terminate automatically when a page has
+* loaded.
+* <li>one serverCore - thread is started, which implements a multi-threaded
+* server. The process may start itself many more processes that handle
+* connections.lo
+* <li>finally, all idle-dependent processes are written in a queue in
+* plasmaSwitchboard which are worked off inside an idle-sensitive loop of the
+* main process. (here)
+* </ul>
+*
+* On termination, the following must be done:
+* <ul>
+* <li>stop feeding of the crawling process because it otherwise fills the
+* indexing queue.
+* <li>say goodbye to connected peers and disable new connections. Don't wait for
+* success.
+* <li>first terminate the serverCore thread. This prevents that new cache
+* objects are queued.
+* <li>wait that the plasmaHTMLCache terminates (it should be normal that this
+* process already has terminated).
+* <li>then wait for termination of all loader process of the
+* plasmaCrawlerLoader.
+* <li>work off the indexing and cache storage queue. These values are inside a
+* RAM cache and would be lost otherwise.
+* <li>write all settings.
+* <li>terminate.
+* </ul>
+*/
+
+public final class yacy {
+
+ // static objects
+ public static final String vString = yacyBuildProperties.getVersion();
+ public static float version = 0.1f;
+
+ public static final String vDATE = yacyBuildProperties.getBuildDate();
+ public static final String copyright = "[ YaCy v" + vString + ", build " + vDATE + " by Michael Christen / www.yacy.net ]";
+ public static final String hline = "-------------------------------------------------------------------------------";
+ public static final Semaphore shutdownSemaphore = new Semaphore(0);
+
+ /**
+ * a reference to the {@link Switchboard} created by the
+ * {@link yacy#startup(String, long, long)} method.
+ */
+ private static Switchboard sb = null;
+ public static String homedir;
+ public static File dataHome_g;
+
+ /**
+ * Starts up the whole application. Sets up all datastructures and starts
+ * the main threads.
+ *
+ * @param homePath Root-path where all information is to be found.
+ * @param startupFree free memory at startup time, to be used later for statistics
+ */
+ private static void startup(final File dataHome, final File appHome, final long startupMemFree, final long startupMemTotal, final boolean gui) {
+ try {
+ // start up
+ System.out.println(copyright);
+ System.out.println(hline);
+
+ // check java version
+ try {
+ "a".codePointAt(0); // needs at least Java 1.5
+ } catch (final NoSuchMethodError e) {
+ System.err.println("STARTUP: Java Version too low. You need at least Java 1.5 to run YaCy"); // TODO: is 1.6 now
+ Thread.sleep(3000);
+ System.exit(-1);
+ }
+
+ // ensure that there is a DATA directory, if not, create one and if that fails warn and die
+ mkdirsIfNeseccary(dataHome);
+ dataHome_g = dataHome;
+ mkdirsIfNeseccary(appHome);
+ File f = new File(dataHome, "DATA/");
+ mkdirsIfNeseccary(f);
+ if (!(f.exists())) {
+ System.err.println("Error creating DATA-directory in " + dataHome.toString() + " . Please check your write-permission for this folder. YaCy will now terminate.");
+ System.exit(-1);
+ }
+
+ homedir = appHome.toString();
+
+ // setting up logging
+ f = new File(dataHome, "DATA/LOG/");
+ mkdirsIfNeseccary(f);
+ f = new File(dataHome, "DATA/LOG/yacy.logging");
+ final File f0 = new File(appHome, "defaults/yacy.logging");
+ if (!f.exists() || f0.lastModified() > f.lastModified()) try {
+ Files.copy(f0, f);
+ } catch (final IOException e){
+ System.out.println("could not copy yacy.logging");
+ }
+ try{
+ Log.configureLogging(dataHome, appHome, new File(dataHome, "DATA/LOG/yacy.logging"));
+ } catch (final IOException e) {
+ System.out.println("could not find logging properties in homePath=" + dataHome);
+ Log.logException(e);
+ }
+ Log.logConfig("STARTUP", "YaCy version: " + yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision());
+ Log.logConfig("STARTUP", "Java version: " + System.getProperty("java.version", "no-java-version"));
+ Log.logConfig("STARTUP", "Operation system: " + System.getProperty("os.name","unknown"));
+ Log.logConfig("STARTUP", "Application root-path: " + appHome);
+ Log.logConfig("STARTUP", "Data root-path: " + dataHome);
+ Log.logConfig("STARTUP", "Time zone: UTC" + GenericFormatter.UTCDiffString() + "; UTC+0000 is " + System.currentTimeMillis());
+ Log.logConfig("STARTUP", "Maximum file system path length: " + OS.maxPathLength);
+
+ f = new File(dataHome, "DATA/yacy.running");
+ if (f.exists()) { // another instance running? VM crash? User will have to care about this
+ Log.logSevere("STARTUP", "WARNING: the file " + f + " exists, this usually means that a YaCy instance is still running");
+ delete(f);
+ }
+ if(!f.createNewFile())
+ Log.logSevere("STARTUP", "WARNING: the file " + f + " can not be created!");
+ try { new FileOutputStream(f).write(Integer.toString(OS.getPID()).getBytes()); } catch (final Exception e) { } // write PID
+ f.deleteOnExit();
+ FileChannel channel = null;
+ FileLock lock = null;
+ try {
+ channel = new RandomAccessFile(f,"rw").getChannel();
+ lock = channel.tryLock(); // lock yacy.running
+ } catch (final Exception e) { };
+
+ final String oldconf = "DATA/SETTINGS/httpProxy.conf".replace("/", File.separator);
+ final String newconf = "DATA/SETTINGS/yacy.conf".replace("/", File.separator);
+ final File oldconffile = new File(dataHome, oldconf);
+ if (oldconffile.exists()) {
+ final File newconfFile = new File(dataHome, newconf);
+ if(!oldconffile.renameTo(newconfFile))
+ Log.logSevere("STARTUP", "WARNING: the file " + oldconffile + " can not be renamed to "+ newconfFile +"!");
+ }
+ try {
+ sb = new Switchboard(dataHome, appHome, "defaults/yacy.init".replace("/", File.separator), newconf);
+ } catch (final RuntimeException e) {
+ Log.logSevere("STARTUP", "YaCy cannot start: " + e.getMessage(), e);
+ System.exit(-1);
+ }
+ //sbSync.V(); // signal that the sb reference was set
+
+ // switch the memory strategy
+ MemoryControl.setStandardStrategy(sb.getConfigBool("memory.standardStrategy", true));
+
+ // save information about available memory at startup time
+ sb.setConfig("memoryFreeAfterStartup", startupMemFree);
+ sb.setConfig("memoryTotalAfterStartup", startupMemTotal);
+
+ // start gui if wanted
+ if (gui) YaCyApp.start("localhost", (int) sb.getConfigLong("port", 8090));
+
+ // hardcoded, forced, temporary value-migration
+ sb.setConfig("htTemplatePath", "htroot/env/templates");
+
+ int oldRev;
+ try {
+ oldRev = Integer.parseInt(sb.getConfig("svnRevision", "0"));
+ } catch (final NumberFormatException e) {
+ oldRev = 0;
+ }
+ final int newRev = Integer.parseInt(yacyBuildProperties.getSVNRevision());
+ sb.setConfig("svnRevision", yacyBuildProperties.getSVNRevision());
+ sb.setConfig("applicationRoot", appHome.toString());
+ sb.setConfig("dataRoot", dataHome.toString());
+ yacyVersion.latestRelease = version;
+
+ // read environment
+ final int timeout = Math.max(5000, Integer.parseInt(sb.getConfig("httpdTimeout", "5000")));
+
+ // create some directories
+ final File htRootPath = new File(appHome, sb.getConfig("htRootPath", "htroot"));
+ final File htDocsPath = sb.getDataPath(SwitchboardConstants.HTDOCS_PATH, SwitchboardConstants.HTDOCS_PATH_DEFAULT);
+ mkdirIfNeseccary(htDocsPath);
+ //final File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));
+
+ // create default notifier picture
+ //TODO: Use templates instead of copying images ...
+ if (!((new File(htDocsPath, "notifier.gif")).exists())) try {
+ Files.copy(new File(htRootPath, "env/grafics/empty.gif"),
+ new File(htDocsPath, "notifier.gif"));
+ } catch (final IOException e) {}
+
+ final File htdocsReadme = new File(htDocsPath, "readme.txt");
+ if (!(htdocsReadme.exists())) try {FileUtils.copy((
+ "This is your root directory for individual Web Content\r\n" +
+ "\r\n" +
+ "Please place your html files into the www subdirectory.\r\n" +
+ "The URL of that path is either\r\n" +
+ "http://www.<your-peer-name>.yacy or\r\n" +
+ "http://<your-ip>:<your-port>/www\r\n" +
+ "\r\n" +
+ "Other subdirectories may be created; they map to corresponding sub-domains.\r\n" +
+ "This directory shares it's content with the applications htroot path, so you\r\n" +
+ "may access your yacy search page with\r\n" +
+ "http://<your-peer-name>.yacy/\r\n" +
+ "\r\n").getBytes(), htdocsReadme);} catch (final IOException e) {
+ System.out.println("Error creating htdocs readme: " + e.getMessage());
+ }
+
+ final File wwwDefaultPath = new File(htDocsPath, "www");
+ mkdirIfNeseccary(wwwDefaultPath);
+
+
+ final File shareDefaultPath = new File(htDocsPath, "share");
+ mkdirIfNeseccary(shareDefaultPath);
+
+ migration.migrate(sb, oldRev, newRev);
+
+ // delete old release files
+ final int deleteOldDownloadsAfterDays = (int) sb.getConfigLong("update.deleteOld", 30);
+ yacyRelease.deleteOldDownloads(sb.releasePath, deleteOldDownloadsAfterDays );
+
+ // set user-agent
+ HTTPClient.setDefaultUserAgent(ClientIdentification.getUserAgent());
+
+ // initial fill of the triplestore
+ File triplestore = new File(sb.getConfig("triplestore", new File(dataHome, "DATA/TRIPLESTORE").getAbsolutePath()));
+ mkdirIfNeseccary(triplestore);
+ for (String s: triplestore.list()) {
+ if ((s.endsWith(".rdf") || s.endsWith(".nt")) && !s.equals("local.rdf") && !s.endsWith("_triplestore.rdf") && !s.startsWith("private_store_")) {
+ try {
+ JenaTripleStore.load(new File(triplestore, s).getAbsolutePath());
+ } catch (IOException e) {
+ Log.logException(e);
+ }
+ }
+ }
+ if (sb.getConfigBool("triplestore.persistent", false)) {
+ File local = new File(triplestore, "local.rdf");
+ if (local.exists()) {
+ try {
+ JenaTripleStore.load(local.getAbsolutePath());
+ } catch (IOException e) {
+ Log.logException(e);
+ }
+ }
+ }
+
+ // start main threads
+ final long port = sb.getConfigLong("port", 8090);
+ try {
-
++
+ // start jetty http server
+ HttpServer httpServer = new HttpServer((int)port);
+ httpServer.start();
+ //final HTTPDemon protocolHandler = new HTTPDemon(sb);
+ //final serverCore server = new serverCore(
+ // timeout /*control socket timeout in milliseconds*/,
+ // true /* block attacks (wrong protocol) */,
+ // protocolHandler /*command class*/,
+ // sb,
+ // 30000 /*command max length incl. GET args*/);
+ //server.setName("httpd:"+port);
+ //server.setPriority(Thread.MAX_PRIORITY);
+ //server.setObeyIntermission(false);
+
+ // start the server
+ //sb.deployThread("10_httpd", "HTTPD Server/Proxy", "the HTTPD, used as web server and proxy", null, server, 0, 0, 0, 0);
+ //server.start();
+
+ // open the browser window
+ final boolean browserPopUpTrigger = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
+ if (browserPopUpTrigger) try {
+ final String browserPopUpPage = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
+ //boolean properPW = (sb.getConfig("adminAccount", "").length() == 0) && (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0);
+ //if (!properPW) browserPopUpPage = "ConfigBasic.html";
-
++
+ Browser.openBrowser((false?"https":"http") + "://localhost:" + port + "/" + browserPopUpPage);
+ } catch (final Throwable e) {
+ // cannot open browser. This may be normal in headless environments
- //Log.logException(e);
++ //Log.logException(e);
+ }
+
+ // enable browser popup, http server is ready now
+ sb.tray.setReady();
+
+ //regenerate Locales from Translationlist, if needed
+ final File locale_source = sb.getAppPath("locale.source", "locales");
+ final String lang = sb.getConfig("locale.language", "");
+ if (!lang.equals("") && !lang.equals("default")) { //locale is used
+ String currentRev = "";
+ try{
+ final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(sb.getDataPath("locale.translated_html", "DATA/LOCALE/htroot"), lang+"/version" ))));
+ currentRev = br.readLine();
+ br.close();
+ }catch(final IOException e){
+ //Error
+ }
+
+ if (!currentRev.equals(sb.getConfig("svnRevision", ""))) try { //is this another version?!
+ final File sourceDir = new File(sb.getConfig("htRootPath", "htroot"));
+ final File destDir = new File(sb.getDataPath("locale.translated_html", "DATA/LOCALE/htroot"), lang);
+ if (Translator.translateFilesRecursive(sourceDir, destDir, new File(locale_source, lang + ".lng"), "html,template,inc", "locale")){ //translate it
+ //write the new Versionnumber
+ final BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(new File(destDir, "version"))));
+ bw.write(sb.getConfig("svnRevision", "Error getting Version"));
+ bw.close();
+ }
+ } catch (final IOException e) {}
+ }
+ // initialize number formatter with this locale
+ Formatter.setLocale(lang);
+
+ // registering shutdown hook
+ Log.logConfig("STARTUP", "Registering Shutdown Hook");
+ final Runtime run = Runtime.getRuntime();
+ run.addShutdownHook(new shutdownHookThread(Thread.currentThread(), sb));
+
+ // save information about available memory after all initializations
+ //try {
+ sb.setConfig("memoryFreeAfterInitBGC", MemoryControl.free());
+ sb.setConfig("memoryTotalAfterInitBGC", MemoryControl.total());
+ System.gc();
+ sb.setConfig("memoryFreeAfterInitAGC", MemoryControl.free());
+ sb.setConfig("memoryTotalAfterInitAGC", MemoryControl.total());
+ //} catch (ConcurrentModificationException e) {}
+
+ // wait for server shutdown
+ try {
+ sb.waitForShutdown();
+ } catch (final Exception e) {
+ Log.logSevere("MAIN CONTROL LOOP", "PANIC: " + e.getMessage(),e);
+ }
+ // shut down
+ Array.terminate();
+ Log.logConfig("SHUTDOWN", "caught termination signal");
+ httpServer.stop();
-
++
+ Log.logConfig("SHUTDOWN", "server has terminated");
+ sb.close();
+ } catch (final Exception e) {
+ Log.logSevere("STARTUP", "Unexpected Error: " + e.getClass().getName(),e);
+ //System.exit(1);
+ }
+ if(lock != null) lock.release();
+ if(channel != null) channel.close();
+ } catch (final Exception ee) {
+ Log.logSevere("STARTUP", "FATAL ERROR: " + ee.getMessage(),ee);
+ } finally {
+ }
+
+ // save the triple store
+ if (sb.getConfigBool("triplestore.persistent", false)) {
+ JenaTripleStore.saveAll();
+ }
+
+ Log.logConfig("SHUTDOWN", "goodbye. (this is the last line)");
+ Log.shutdown();
+ shutdownSemaphore.release(1000);
+ try {
+ System.exit(0);
+ } catch (final Exception e) {} // was once stopped by de.anomic.net.ftpc$sm.checkExit(ftpc.java:1790)
+ }
+
+ /**
+ * @param f
+ */
+ private static void delete(final File f) {
+ if(!f.delete())
+ Log.logSevere("STARTUP", "WARNING: the file " + f + " can not be deleted!");
+ }
+
+ /**
+ * @see File#mkdir()
+ * @param path
+ */
+ private static void mkdirIfNeseccary(final File path) {
+ if (!(path.exists()))
+ if(!path.mkdir())
+ Log.logWarning("STARTUP", "could not create directory "+ path.toString());
+ }
+
+ /**
+ * @see File#mkdirs()
+ * @param path
+ */
+ public static void mkdirsIfNeseccary(final File path) {
+ if (!(path.exists()))
+ if(!path.mkdirs())
+ Log.logWarning("STARTUP", "could not create directories "+ path.toString());
+ }
+
+ /**
+ * Loads the configuration from the data-folder.
+ * FIXME: Why is this called over and over again from every method, instead
+ * of setting the configurationdata once for this class in main?
+ *
+ * @param mes Where are we called from, so that the errormessages can be
+ * more descriptive.
+ * @param homePath Root-path where all the information is to be found.
+ * @return Properties read from the configurationfile.
+ */
+ private static Properties configuration(final String mes, final File homePath) {
+ Log.logConfig(mes, "Application Root Path: " + homePath.toString());
+
+ // read data folder
+ final File dataFolder = new File(homePath, "DATA");
+ if (!(dataFolder.exists())) {
+ Log.logSevere(mes, "Application was never started or root path wrong.");
+ System.exit(-1);
+ }
+
+ final Properties config = new Properties();
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(new File(homePath, "DATA/SETTINGS/yacy.conf"));
+ config.load(fis);
+ } catch (final FileNotFoundException e) {
+ Log.logSevere(mes, "could not find configuration file.");
+ System.exit(-1);
+ } catch (final IOException e) {
+ Log.logSevere(mes, "could not read configuration file.");
+ System.exit(-1);
+ } finally {
+ if(fis != null) {
+ try {
+ fis.close();
+ } catch (final IOException e) {
+ Log.logException(e);
+ }
+ }
+ }
+
+ return config;
+ }
+
+ /**
+ * Call the shutdown-page of YaCy to tell it to shut down. This method is
+ * called if you start yacy with the argument -shutdown.
+ *
+ * @param homePath Root-path where all the information is to be found.
+ */
+ public static void shutdown(final File homePath) {
+ // start up
+ System.out.println(copyright);
+ System.out.println(hline);
+ submitURL(homePath, "Steering.html?shutdown=", "Terminate YaCy");
+ }
+
+ public static void update(final File homePath) {
+ // start up
+ System.out.println(copyright);
+ System.out.println(hline);
+ submitURL(homePath, "ConfigUpdate_p.html?autoUpdate=", "Update YaCy to most recent version");
+ }
+
+ private static void submitURL(final File homePath, final String path, final String processdescription) {
+ final Properties config = configuration("COMMAND-STEERING", homePath);
+
+ // read port
+ final int port = serverCore.getPortNr(config.getProperty("port", "8090"));
+
+ // read password
+ String encodedPassword = (String) config.get(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5);
+ if (encodedPassword == null) encodedPassword = ""; // not defined
+
+ // send 'wget' to web interface
+ final RequestHeader requestHeader = new RequestHeader();
+ requestHeader.put(RequestHeader.AUTHORIZATION, "realm=" + encodedPassword); // for http-authentify
+// final Client con = new Client(10000, requestHeader);
+ final HTTPClient con = new HTTPClient();
+ con.setHeader(requestHeader.entrySet());
+// ResponseContainer res = null;
+ try {
+// res = con.GET("http://localhost:"+ port +"/" + path);
+ con.GETbytes("http://localhost:"+ port +"/" + path);
+
+ // read response
+// if (res.getStatusLine().startsWith("2")) {
+ if (con.getStatusCode() > 199 && con.getStatusCode() < 300) {
+ Log.logConfig("COMMAND-STEERING", "YACY accepted steering command: " + processdescription);
+// final ByteArrayOutputStream bos = new ByteArrayOutputStream(); //This is stream is not used???
+// try {
+// FileUtils.copyToStream(new BufferedInputStream(res.getDataAsStream()), new BufferedOutputStream(bos));
+// } finally {
+// res.closeStream();
+// }
+ } else {
+// Log.logSevere("COMMAND-STEERING", "error response from YACY socket: " + res.getStatusLine());
+ Log.logSevere("COMMAND-STEERING", "error response from YACY socket: " + con.getHttpResponse().getStatusLine());
+ System.exit(-1);
+ }
+ } catch (final IOException e) {
+ Log.logSevere("COMMAND-STEERING", "could not establish connection to YACY socket: " + e.getMessage());
+ System.exit(-1);
+// } finally {
+// // release connection
+// if(res != null) {
+// res.closeStream();
+// }
+ }
+
+ try {
+ HTTPClient.closeConnectionManager();
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ // finished
+ Log.logConfig("COMMAND-STEERING", "SUCCESSFULLY FINISHED COMMAND: " + processdescription);
+ }
+
+ /**
+ * This method gets all found words and outputs a statistic about the score
+ * of the words. The output of this method can be used to create stop-word
+ * lists. This method will be called if you start yacy with the argument
+ * -genwordstat.
+ * FIXME: How can stop-word list be created from this output? What type of
+ * score is output?
+ *
+ * @param homePath Root-Path where all the information is to be found.
+ */
+ private static void genWordstat(final File homePath) {
+ // start up
+ System.out.println(copyright);
+ System.out.println(hline);
+
+ // load words
+ Log.logInfo("GEN-WORDSTAT", "loading words...");
+ final TreeMap<byte[], String> words = loadWordMap(new File(homePath, "yacy.words"));
+
+ // find all hashes
+ Log.logInfo("GEN-WORDSTAT", "searching all word-hash databases...");
+ final File dbRoot = new File(homePath, "DATA/INDEX/freeworld/");
+ final enumerateFiles ef = new enumerateFiles(new File(dbRoot, "WORDS"), true, false, true, true);
+ File f;
+ byte[] h;
+ final ScoreMap<byte[]> hs = new OrderedScoreMap<byte[]>(Base64Order.standardCoder);
+ while (ef.hasMoreElements()) {
+ f = ef.nextElement();
+ h = f.getName().substring(0, Word.commonHashLength).getBytes();
+ hs.inc(h, (int) f.length());
+ }
+
+ // list the hashes in reverse order
+ Log.logInfo("GEN-WORDSTAT", "listing words in reverse size order...");
+ String w;
+ final Iterator<byte[]> i = hs.keys(false);
+ while (i.hasNext()) {
+ h = i.next();
+ w = words.get(h);
+ if (w == null) System.out.print("# " + h); else System.out.print(w);
+ System.out.println(" - " + hs.get(h));
+ }
+
+ // finished
+ Log.logConfig("GEN-WORDSTAT", "FINISHED");
+ }
+
+ /**
+ * @param homePath path to the YaCy directory
+ * @param networkName
+ */
+ public static void minimizeUrlDB(final File dataHome, final File appHome, final String networkName) {
+ // run with "java -classpath classes yacy -minimizeUrlDB"
+ try {Log.configureLogging(dataHome, appHome, new File(dataHome, "DATA/LOG/yacy.logging"));} catch (final Exception e) {}
+ final File indexPrimaryRoot = new File(dataHome, "DATA/INDEX");
+ final File indexRoot2 = new File(dataHome, "DATA/INDEX2");
+ final Log log = new Log("URL-CLEANUP");
+ try {
+ log.logInfo("STARTING URL CLEANUP");
+
+ // db containing all currently loades urls
+ final MetadataRepository currentUrlDB = new MetadataRepository(new File(new File(indexPrimaryRoot, networkName), "TEXT"), "text.urlmd", false, false);
+
+ // db used to hold all neede urls
+ final MetadataRepository minimizedUrlDB = new MetadataRepository(new File(new File(indexRoot2, networkName), "TEXT"), "text.urlmd", false, false);
+
+ final int cacheMem = (int)(MemoryControl.maxMemory() - MemoryControl.total());
+ if (cacheMem < 2048000) throw new OutOfMemoryError("Not enough memory available to start clean up.");
+
+ final Segment wordIndex = new Segment(
+ log,
+ new File(new File(indexPrimaryRoot, "freeworld"), "TEXT"),
+ 10000,
+ (long) Integer.MAX_VALUE, false, false);
+ final Iterator<ReferenceContainer<WordReference>> indexContainerIterator = wordIndex.termIndex().referenceContainerIterator("AAAAAAAAAAAA".getBytes(), false, false);
+
+ long urlCounter = 0, wordCounter = 0;
+ long wordChunkStart = System.currentTimeMillis(), wordChunkEnd = 0;
+ String wordChunkStartHash = "AAAAAAAAAAAA", wordChunkEndHash;
+
+ while (indexContainerIterator.hasNext()) {
+ ReferenceContainer<WordReference> wordIdxContainer = null;
+ try {
+ wordCounter++;
+ wordIdxContainer = indexContainerIterator.next();
+
+ // the combined container will fit, read the container
+ final Iterator<WordReference> wordIdxEntries = wordIdxContainer.entries();
+ Reference iEntry;
+ while (wordIdxEntries.hasNext()) {
+ iEntry = wordIdxEntries.next();
+ final byte[] urlHash = iEntry.urlhash();
+ if ((currentUrlDB.exists(urlHash)) && (!minimizedUrlDB.exists(urlHash))) try {
+ final URIMetadataRow urlEntry = currentUrlDB.load(urlHash);
+ urlCounter++;
+ minimizedUrlDB.store(urlEntry);
+ if (urlCounter % 500 == 0) {
+ log.logInfo(urlCounter + " URLs found so far.");
+ }
+ } catch (final IOException e) {}
+ }
+
+ if (wordCounter%500 == 0) {
+ wordChunkEndHash = ASCII.String(wordIdxContainer.getTermHash());
+ wordChunkEnd = System.currentTimeMillis();
+ final long duration = wordChunkEnd - wordChunkStart;
+ log.logInfo(wordCounter + " words scanned " +
+ "[" + wordChunkStartHash + " .. " + wordChunkEndHash + "]\n" +
+ "Duration: "+ 500*1000/duration + " words/s" +
+ " | Free memory: " + MemoryControl.free() +
+ " | Total memory: " + MemoryControl.total());
+ wordChunkStart = wordChunkEnd;
+ wordChunkStartHash = wordChunkEndHash;
+ }
+
+ // we have read all elements, now we can close it
+ wordIdxContainer = null;
+
+ } catch (final Exception e) {
+ log.logSevere("Exception", e);
+ } finally {
+ if (wordIdxContainer != null) try { wordIdxContainer = null; } catch (final Exception e) {}
+ }
+ }
+ log.logInfo("current LURL DB contains " + currentUrlDB.size() + " entries.");
+ log.logInfo("mimimized LURL DB contains " + minimizedUrlDB.size() + " entries.");
+
+ currentUrlDB.close();
+ minimizedUrlDB.close();
+ wordIndex.close();
+
+ // TODO: rename the mimimized UrlDB to the name of the previous UrlDB
+
+ log.logInfo("FINISHED URL CLEANUP, WAIT FOR DUMP");
+ log.logInfo("You can now backup your old URL DB and rename minimized/urlHash.db to urlHash.db");
+
+ log.logInfo("TERMINATED URL CLEANUP");
+ } catch (final Exception e) {
+ log.logSevere("Exception: " + e.getMessage(), e);
+ } catch (final Error e) {
+ log.logSevere("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Reads all words from the given file and creates a treemap, where key is
+ * the plasma word hash and value is the word itself.
+ *
+ * @param wordlist File where the words are stored.
+ * @return HashMap with the hash-word - relation.
+ */
+ private static TreeMap<byte[], String> loadWordMap(final File wordlist) {
+ // returns a hash-word - Relation
+ final TreeMap<byte[], String> wordmap = new TreeMap<byte[], String>(Base64Order.enhancedCoder);
+ try {
+ String word;
+ final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(wordlist)));
+ while ((word = br.readLine()) != null) wordmap.put(Word.word2hash(word), word);
+ br.close();
+ } catch (final IOException e) {}
+ return wordmap;
+ }
+
+ /**
+ * Cleans a wordlist in a file according to the length of the words. The
+ * file with the given filename is read and then only the words in the given
+ * length-range are written back to the file.
+ *
+ * @param wordlist Name of the file the words are stored in.
+ * @param minlength Minimal needed length for each word to be stored.
+ * @param maxlength Maximal allowed length for each word to be stored.
+ */
+ private static void cleanwordlist(final String wordlist, final int minlength, final int maxlength) {
+ // start up
+ System.out.println(copyright);
+ System.out.println(hline);
+ Log.logConfig("CLEAN-WORDLIST", "START");
+
+ String word;
+ final TreeSet<String> wordset = new TreeSet<String>();
+ int count = 0;
+ try {
+ final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(wordlist)));
+ final String seps = "' .,:/-&";
+ while ((word = br.readLine()) != null) {
+ word = word.toLowerCase().trim();
+ for (int i = 0; i < seps.length(); i++) {
+ if (word.indexOf(seps.charAt(i)) >= 0) word = word.substring(0, word.indexOf(seps.charAt(i)));
+ }
+ if ((word.length() >= minlength) && (word.length() <= maxlength)) wordset.add(word);
+ count++;
+ }
+ br.close();
+
+ if (wordset.size() != count) {
+ count = count - wordset.size();
+ final BufferedWriter bw = new BufferedWriter(new PrintWriter(new FileWriter(wordlist)));
+ while (!wordset.isEmpty()) {
+ word = wordset.first();
+ bw.write(word + "\n");
+ wordset.remove(word);
+ }
+ bw.close();
+ Log.logInfo("CLEAN-WORDLIST", "shrinked wordlist by " + count + " words.");
+ } else {
+ Log.logInfo("CLEAN-WORDLIST", "not necessary to change wordlist");
+ }
+ } catch (final IOException e) {
+ Log.logSevere("CLEAN-WORDLIST", "ERROR: " + e.getMessage());
+ System.exit(-1);
+ }
+
+ // finished
+ Log.logConfig("CLEAN-WORDLIST", "FINISHED");
+ }
+
+ private static String[] shift(final String[] args, final int pos, final int count) {
+ final String[] newargs = new String[args.length - count];
+ System.arraycopy(args, 0, newargs, 0, pos);
+ System.arraycopy(args, pos + count, newargs, pos, args.length - pos - count);
+ return newargs;
+ }
+
+ /**
+ * Uses an Iteration over urlHash.db to detect malformed URL-Entries.
+ * Damaged URL-Entries will be marked in a HashSet and removed at the end of the function.
+ *
+ * @param homePath Root-Path where all information is to be found.
+ */
+ private static void urldbcleanup(final File dataHome, final File appHome, final String networkName) {
+ final File root = dataHome;
+ final File indexroot = new File(root, "DATA/INDEX");
+ try {Log.configureLogging(dataHome, appHome, new File(dataHome, "DATA/LOG/yacy.logging"));} catch (final Exception e) {}
+ final MetadataRepository currentUrlDB = new MetadataRepository(new File(new File(indexroot, networkName), "TEXT"), "text.urlmd", false, false);
+ currentUrlDB.deadlinkCleaner();
+ currentUrlDB.close();
+ }
+
+ private static void RWIHashList(final File dataHome, final File appHome, final String targetName, final String resource, final String format) {
+ Segment WordIndex = null;
+ final Log log = new Log("HASHLIST");
+ final File indexPrimaryRoot = new File(dataHome, "DATA/INDEX");
+ final String wordChunkStartHash = "AAAAAAAAAAAA";
+ try {Log.configureLogging(dataHome, appHome, new File(dataHome, "DATA/LOG/yacy.logging"));} catch (final Exception e) {}
+ log.logInfo("STARTING CREATION OF RWI-HASHLIST");
+ final File root = dataHome;
+ try {
+ Iterator<ReferenceContainer<WordReference>> indexContainerIterator = null;
+ if (resource.equals("all")) {
+ WordIndex = new Segment(
+ log,
+ new File(new File(indexPrimaryRoot, "freeworld"), "TEXT"),
+ 10000,
+ (long) Integer.MAX_VALUE, false, false);
+ indexContainerIterator = WordIndex.termIndex().referenceContainerIterator(wordChunkStartHash.getBytes(), false, false);
+ }
+ int counter = 0;
+ ReferenceContainer<WordReference> container = null;
+ if (format.equals("zip")) {
+ log.logInfo("Writing Hashlist to ZIP-file: " + targetName + ".zip");
+ final ZipEntry zipEntry = new ZipEntry(targetName + ".txt");
+ final File file = new File(root, targetName + ".zip");
+ final ZipOutputStream bos = new ZipOutputStream(new FileOutputStream(file));
+ bos.putNextEntry(zipEntry);
+ if(indexContainerIterator != null) {
+ while (indexContainerIterator.hasNext()) {
+ counter++;
+ container = indexContainerIterator.next();
+ bos.write(container.getTermHash());
+ bos.write(serverCore.CRLF);
+ if (counter % 500 == 0) {
+ log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + ASCII.String(container.getTermHash()));
+ }
+ }
+ }
+ bos.flush();
+ bos.close();
+ } else {
+ log.logInfo("Writing Hashlist to TXT-file: " + targetName + ".txt");
+ final File file = new File(root, targetName + ".txt");
+ final BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
+ if(indexContainerIterator != null) {
+ while (indexContainerIterator.hasNext()) {
+ counter++;
+ container = indexContainerIterator.next();
+ bos.write(container.getTermHash());
+ bos.write(serverCore.CRLF);
+ if (counter % 500 == 0) {
+ log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + ASCII.String(container.getTermHash()));
+ }
+ }
+ }
+ bos.flush();
+ bos.close();
+ }
+ log.logInfo("Total number of Hashs: " + counter + ". Last found Hash: " + (container == null ? "null" : ASCII.String(container.getTermHash())));
+ } catch (final IOException e) {
+ log.logSevere("IOException", e);
+ }
+ if (WordIndex != null) {
+ WordIndex.close();
+ WordIndex = null;
+ }
+ }
+
+ /**
+ * Searching for peers affected by Bug
+ * @param homePath
+ */
+ public static void testPeerDB(final File homePath) {
+
+ try {
+ final File yacyDBPath = new File(homePath, "DATA/INDEX/freeworld/NETWORK");
+
+ final String[] dbFileNames = {"seed.new.db","seed.old.db","seed.pot.db"};
+ for (final String dbFileName : dbFileNames) {
+ final File dbFile = new File(yacyDBPath,dbFileName);
+ final MapDataMining db = new MapDataMining(dbFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, SeedDB.sortFields, SeedDB.longaccFields, SeedDB.doubleaccFields, null);
+
+ Iterator<Map.Entry<byte[], Map<String, String>>> it;
+ it = db.entries(true, false);
+ while (it.hasNext()) {
+ final Map.Entry<byte[], Map<String, String>> dna = it.next();
+ String peerHash = UTF8.String(dna.getKey());
+ if (peerHash.length() < Word.commonHashLength) {
+ final String peerName = dna.getValue().get("Name");
+ final String peerIP = dna.getValue().get("IP");
+ final String peerPort = dna.getValue().get("Port");
+
+ while (peerHash.length() < Word.commonHashLength) { peerHash = peerHash + "_"; }
+ System.err.println("Invalid Peer-Hash found in '" + dbFileName + "': " + peerName + ":" + peerHash + ", http://" + peerIP + ":" + peerPort);
+ }
+ }
+ db.close();
+ }
+ } catch (final Exception e) {
+ Log.logException(e);
+ }
+ }
+
+
+ /**
+ * Main-method which is started by java. Checks for special arguments or
+ * starts up the application.
+ *
+ * @param args
+ * Given arguments from the command line.
+ */
+ public static void main(String args[]) {
+
+ try {
+
+ // check assertion status
+ //ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
+ boolean assertionenabled = false;
+ assert assertionenabled = true;
+ if (assertionenabled) System.out.println("Asserts are enabled");
+
+ // check memory amount
+ System.gc();
+ final long startupMemFree = MemoryControl.free();
+ final long startupMemTotal = MemoryControl.total();
+
+ // maybe go into headless awt mode: we have three cases depending on OS and one exception:
+ // windows : better do not go into headless mode
+ // mac : go into headless mode because an application is shown in gui which may not be wanted
+ // linux : go into headless mode because this does not need any head operation
+ // exception : if the -gui option is used then do not go into headless mode since that uses a gui
+ boolean headless = true;
+ if (OS.isWindows) headless = false;
+ if (args.length >= 1 && args[0].toLowerCase().equals("-gui")) headless = false;
+ System.setProperty("java.awt.headless", headless ? "true" : "false");
+
+ String s = ""; for (final String a: args) s += a + " ";
+ yacyRelease.startParameter = s.trim();
+
+ File applicationRoot = new File(System.getProperty("user.dir").replace('\\', '/'));
+ File dataRoot = applicationRoot;
+ //System.out.println("args.length=" + args.length);
+ //System.out.print("args=["); for (int i = 0; i < args.length; i++) System.out.print(args[i] + ", "); System.out.println("]");
+ if ((args.length >= 1) && (args[0].toLowerCase().equals("-startup") || args[0].equals("-start"))) {
+ // normal start-up of yacy
+ if (args.length > 1) dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
+ startup(dataRoot, applicationRoot, startupMemFree, startupMemTotal, false);
+ } else if (args.length >= 1 && args[0].toLowerCase().equals("-gui")) {
+ // start-up of yacy with gui
+ if (args.length > 1) dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
+ startup(dataRoot, applicationRoot, startupMemFree, startupMemTotal, true);
+ } else if ((args.length >= 1) && ((args[0].toLowerCase().equals("-shutdown")) || (args[0].equals("-stop")))) {
+ // normal shutdown of yacy
+ if (args.length == 2) applicationRoot= new File(args[1]);
+ shutdown(applicationRoot);
+ } else if ((args.length >= 1) && (args[0].toLowerCase().equals("-update"))) {
+ // aut-update yacy
+ if (args.length == 2) applicationRoot= new File(args[1]);
+ update(applicationRoot);
+ } else if ((args.length >= 1) && (args[0].toLowerCase().equals("-version"))) {
+ // show yacy version
+ System.out.println(copyright);
+ } else if ((args.length >= 1) && (args[0].toLowerCase().equals("-minimizeurldb"))) {
+ // migrate words from DATA/PLASMADB/WORDS path to assortment cache, if possible
+ // attention: this may run long and should not be interrupted!
+ if (args.length >= 3 && args[1].toLowerCase().equals("-cache")) {
+ args = shift(args, 1, 2);
+ }
+ if (args.length == 2) applicationRoot= new File(args[1]);
+ minimizeUrlDB(dataRoot, applicationRoot, "freeworld");
+ } else if ((args.length >= 1) && (args[0].toLowerCase().equals("-testpeerdb"))) {
+ if (args.length == 2) {
+ applicationRoot = new File(args[1]);
+ } else if (args.length > 2) {
+ System.err.println("Usage: -testPeerDB [homeDbRoot]");
+ }
+ testPeerDB(applicationRoot);
+ } else if ((args.length >= 1) && (args[0].toLowerCase().equals("-genwordstat"))) {
+ // this can help to create a stop-word list
+ // to use this, you need a 'yacy.words' file in the root path
+ // start this with "java -classpath classes yacy -genwordstat [<rootdir>]"
+ if (args.length == 2) applicationRoot= new File(args[1]);
+ genWordstat(applicationRoot);
+ } else if ((args.length == 4) && (args[0].toLowerCase().equals("-cleanwordlist"))) {
+ // this can be used to organize and clean a word-list
+ // start this with "java -classpath classes yacy -cleanwordlist <word-file> <minlength> <maxlength>"
+ final int minlength = Integer.parseInt(args[2]);
+ final int maxlength = Integer.parseInt(args[3]);
+ cleanwordlist(args[1], minlength, maxlength);
+ } else if ((args.length >= 1) && (args[0].toLowerCase().equals("-urldbcleanup"))) {
+ // generate a url list and save it in a file
+ if (args.length == 2) applicationRoot= new File(args[1]);
+ urldbcleanup(dataRoot, applicationRoot, "freeworld");
+ } else if ((args.length >= 1) && (args[0].toLowerCase().equals("-rwihashlist"))) {
+ // generate a url list and save it in a file
+ String domain = "all";
+ String format = "txt";
+ if (args.length >= 2) domain= args[1];
+ if (args.length >= 3) format= args[2];
+ if (args.length == 4) applicationRoot= new File(args[3]);
+ final String outfile = "rwihashlist_" + System.currentTimeMillis();
+ RWIHashList(dataRoot, applicationRoot, outfile, domain, format);
+ } else {
+ if (args.length == 1) applicationRoot= new File(args[0]);
+ startup(dataRoot, applicationRoot, startupMemFree, startupMemTotal, false);
+ }
+ } finally {
+ Log.shutdown();
+ }
+ }
+}
+
+/**
+* This class is a helper class whose instance is started, when the java virtual
+* machine shuts down. Signals the plasmaSwitchboard to shut down.
+*/
+class shutdownHookThread extends Thread {
+ private final Switchboard sb;
+ private final Thread mainThread;
+
+ public shutdownHookThread(final Thread mainThread, final Switchboard sb) {
+ super();
+ this.sb = sb;
+ this.mainThread = mainThread;
+ }
+
+ public void run() {
+ try {
+ if (!this.sb.isTerminated()) {
+ Log.logConfig("SHUTDOWN","Shutdown via shutdown hook.");
+
+ // sending the yacy main thread a shutdown signal
+ Log.logFine("SHUTDOWN","Signaling shutdown to the switchboard.");
+ this.sb.terminate("shutdown hook");
+
+ // waiting for the yacy thread to finish execution
+ Log.logFine("SHUTDOWN","Waiting for main thread to finish.");
+ if (this.mainThread.isAlive() && !this.sb.isTerminated()) {
+ this.mainThread.join();
+ }
+ }
+ } catch (final Exception e) {
+ Log.logSevere("SHUTDOWN","Unexpected error. " + e.getClass().getName(),e);
+ }
+ }
+}