replaced old JavaApplicationStub for Mac Application framework with new

script. Adopted the YaCyApp environment and fixed a problem in the
startYACY.sh application wrapper which caused wrong usage of logging
option -l which caused that files had been written to the YaCy
application folder.
As a result of this fix, it is not necessary any more to change path
settings in Info.plist if libraries are changed.
pull/1/head
Michael Peter Christen 10 years ago
parent 2bc2564668
commit 287c528f46

@ -4,14 +4,22 @@
<dict>
<key>CFBundleName</key>
<string>YaCy</string>
<key>CFBundleDisplayName</key>
<string>YaCy</string>
<key>CFBundleShortVersionString</key>
<string>1.82</string>
<key>CFBundleGetInfoString</key>
<string>Peer-to-Peer Search Engine</string>
<key>NSHumanReadableCopyright</key>
<string>GPL-2.0</string>
<key>CFBundleIdentifier</key>
<string>net.yacy.yacy</string>
<key>CFBundleVersion</key>
<string>@REPL_VERSION@</string>
<string>1.82</string>
<key>CFBundleAllowMixedLocalizations</key>
<string>true</string>
<key>CFBundleExecutable</key>
<string>JavaApplicationStub</string>
<string>JavaApplicationStub</string><!-- relative to Contents/MacOS -->
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundlePackageType</key>
@ -21,106 +29,6 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleIconFile</key>
<string>YaCy_2013_Icon.icns</string>
<key>Java</key>
<dict>
<key>VMOptions</key>
<string>-Xmx600m -Xms600m -Dfile.encoding=UTF-8 -Dsolr.directoryFactory=solr.MMapDirectoryFactory</string>
<key>WorkingDirectory</key>
<string>$APP_PACKAGE/Contents/Resources/Java</string>
<key>MainClass</key>
<string>net.yacy.yacy</string>
<key>JVMVersion</key>
<string>1.5+</string>
<key>Arguments</key>
<string>-gui Library/YaCy</string>
<key>ClassPath</key>
<array>
<string>$JAVAROOT/htroot</string>
<string>$JAVAROOT/lib/apache-mime4j-0.6.jar</string>
<string>$JAVAROOT/lib/bcmail-jdk15-1.46.jar</string>
<string>$JAVAROOT/lib/bcprov-jdk15-1.46.jar</string>
<string>$JAVAROOT/lib/chardet.jar</string>
<string>$JAVAROOT/lib/commons-codec-1.9.jar</string>
<string>$JAVAROOT/lib/commons-compress-1.8.1.jar</string>
<string>$JAVAROOT/lib/commons-fileupload-1.3.1.jar</string>
<string>$JAVAROOT/lib/commons-io-2.3.jar</string>
<string>$JAVAROOT/lib/commons-jxpath-1.3.jar</string>
<string>$JAVAROOT/lib/commons-lang-2.6.jar</string>
<string>$JAVAROOT/lib/commons-logging-1.2.jar</string>
<string>$JAVAROOT/lib/fontbox-1.8.8.jar</string>
<string>$JAVAROOT/lib/geronimo-stax-api_1.0_spec-1.0.1.jar</string>
<string>$JAVAROOT/lib/guava-18.0.jar</string>
<string>$JAVAROOT/lib/htmllexer.jar</string>
<string>$JAVAROOT/lib/httpclient-4.3.6.jar</string>
<string>$JAVAROOT/lib/httpcore-4.3.3.jar</string>
<string>$JAVAROOT/lib/httpmime-4.3.6.jar</string>
<string>$JAVAROOT/lib/icu4j-core.jar</string>
<string>$JAVAROOT/lib/J7Zip-modified.jar</string>
<string>$JAVAROOT/lib/jakarta-oro-2.0.8.jar</string>
<string>$JAVAROOT/lib/jaudiotagger-2.0.4-20111207.115108-15.jar</string>
<string>$JAVAROOT/lib/jcifs-1.3.17.jar</string>
<string>$JAVAROOT/lib/jcl-over-slf4j-1.7.9.jar</string>
<string>$JAVAROOT/lib/jempbox-1.8.8.jar</string>
<string>$JAVAROOT/lib/javax.servlet-api-3.1.0.jar</string>
<string>$JAVAROOT/lib/jetty-client-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-continuation-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-deploy-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-http-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-io-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-jmx-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-proxy-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-security-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-server-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-servlet-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-servlets-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-util-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-webapp-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jetty-xml-9.2.6.v20141205.jar</string>
<string>$JAVAROOT/lib/jsch-0.1.51.jar</string>
<string>$JAVAROOT/lib/json-simple-1.1.1.jar</string>
<string>$JAVAROOT/lib/jsoup-1.8.1.jar</string>
<string>$JAVAROOT/lib/log4j-over-slf4j-1.7.9.jar</string>
<string>$JAVAROOT/lib/lucene-analyzers-common-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-analyzers-phonetic-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-classification-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-codecs-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-core-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-facet-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-grouping-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-highlighter-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-join-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-memory-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-misc-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-queries-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-queryparser-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-spatial-4.10.3.jar</string>
<string>$JAVAROOT/lib/lucene-suggest-4.10.3.jar</string>
<string>$JAVAROOT/lib/metadata-extractor-2.7.0.jar</string>
<string>$JAVAROOT/lib/noggit-0.5.jar</string>
<string>$JAVAROOT/lib/org.restlet.jar</string>
<string>$JAVAROOT/lib/pdfbox-1.8.8.jar</string>
<string>$JAVAROOT/lib/poi-3.10.1.jar</string>
<string>$JAVAROOT/lib/poi-scratchpad-3.10.1.jar</string>
<string>$JAVAROOT/lib/slf4j-api-1.7.9.jar</string>
<string>$JAVAROOT/lib/slf4j-jdk14-1.7.9.jar</string>
<string>$JAVAROOT/lib/solr-core-4.10.3.jar</string>
<string>$JAVAROOT/lib/solr-solrj-4.10.3.jar</string>
<string>$JAVAROOT/lib/spatial4j-0.4.1.jar</string>
<string>$JAVAROOT/lib/webcat-0.1-swf.jar</string>
<string>$JAVAROOT/lib/weupnp-0.1.2.jar</string>
<string>$JAVAROOT/lib/wstx-asl-3.2.9.jar</string>
<string>$JAVAROOT/lib/xercesImpl.jar</string>
<string>$JAVAROOT/lib/xml-apis.jar</string>
<string>$JAVAROOT/lib/xmpcore-5.1.2.jar</string>
<string>$JAVAROOT/lib/yacycore.jar</string>
<string>$JAVAROOT/lib/zookeeper-3.4.6.jar</string>
</array>
<key>Properties</key>
<dict>
<key>apple.laf.useScreenMenuBar</key>
<string>true</string>
</dict>
</dict>
<string>YaCy_2013_Icon.icns</string><!-- relative to Contents/Resources -->
</dict>
</plist>

@ -771,6 +771,7 @@
<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"/>
<chmod file="${release_mac}/YaCy.app/Contents/Resources/Java/startYACY.sh" perm="755"/>
<exec executable="hdiutil">
<arg line="create -srcfolder ${release_mac}/YaCy.app ${release}/yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.dmg"/>
</exec>

@ -0,0 +1,46 @@
/**
* Toolkits
* Copyright 2015 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
* First released 22.01.2015 at http://yacy.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program in the file lgpl21.txt
* If not, see <http://www.gnu.org/licenses/>.
*/
package net.yacy.gui;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import net.yacy.cora.util.ConcurrentLog;
public class Toolkits {
public static Class<?> applicationClass, quitHandlerClass;
public static Object applicationInstance;
public static Method applicationGetApplication, setDockIconImage, setQuitHandler;
static {
try {
applicationClass = Class.forName("com.apple.eawt.Application");
quitHandlerClass = Class.forName("com.apple.eawt.QuitHandler");
applicationGetApplication = applicationClass.getMethod("getApplication");
setQuitHandler = applicationClass.getMethod("setQuitHandler", quitHandlerClass);
applicationInstance = applicationGetApplication.invoke(null);
setDockIconImage = applicationClass.getMethod("setDockIconImage", Class.forName("java.awt.Image"));
} catch (ClassNotFoundException|NoSuchMethodException|SecurityException|IllegalAccessException|IllegalArgumentException|InvocationTargetException e) {
ConcurrentLog.logException(e);
}
}
}

@ -39,7 +39,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import javax.imageio.ImageIO;
@ -149,11 +148,7 @@ public final class Tray {
private static void setDockIcon(Image icon) {
if (!OS.isMacArchitecture) return;
try {
Class<?> applicationClass = Class.forName("com.apple.eawt.Application");
Method applicationGetApplication = applicationClass.getMethod("getApplication");
Object applicationInstance = applicationGetApplication.invoke(null);
Method setDockIconImage = applicationClass.getMethod("setDockIconImage", Class.forName("java.awt.Image"));
setDockIconImage.invoke(applicationInstance, icon);
Toolkits.setDockIconImage.invoke(Toolkits.applicationInstance, icon);
} catch (Throwable e) {}
// same as: Application.getApplication().setDockIconImage(i);
}

@ -90,14 +90,45 @@ public class YaCyApp {
public void closeAndExit() {
if (this.app != null) this.app.setVisible(false); // fake closing
//Browser.openBrowser("http://" + host + ":" + port + "/Steering.html?shutdown=");
net.yacy.search.Switchboard.getSwitchboard().terminate(10, "shutdown request from gui");
net.yacy.search.Switchboard.getSwitchboard().terminate(10, "shutdown request from gui(1)");
Switchboard.shutdown();
//System.exit(0);
}
}
public static void start(final String host, final int port) {
System.setProperty("apple.eawt.quitStrategy", "CLOSE_ALL_WINDOWS");
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name","YaCy Search Engine");
/*
com.apple.eawt.Application osxapp = com.apple.eawt.Application.getApplication();
osxapp.setAboutHandler(new com.apple.eawt.AboutHandler() {
@Override public void handleAbout(com.apple.eawt.AppEvent.AboutEvent evt) {}
});
osxapp.setPreferencesHandler(new com.apple.eawt.PreferencesHandler() {
@Override public void handlePreferences(com.apple.eawt.AppEvent.PreferencesEvent pe) {}
});
osxapp.setQuitHandler(new com.apple.eawt.QuitHandler(){
@Override public void handleQuitRequestWith(com.apple.eawt.AppEvent.QuitEvent evt, com.apple.eawt.QuitResponse resp) {
net.yacy.search.Switchboard.getSwitchboard().terminate(10, "shutdown request from gui(2)");
Switchboard.shutdown();
}
});
*/
/*
com.apple.eawt.QuitHandler quitHandler = new com.apple.eawt.QuitHandler() {
@Override public void handleQuitRequestWith(com.apple.eawt.AppEvent.QuitEvent evt, com.apple.eawt.QuitResponse resp) {
net.yacy.search.Switchboard.getSwitchboard().terminate(10, "shutdown request from gui(2)");
Switchboard.shutdown();
}
};
try {
Toolkits.applicationGetApplication.invoke(Toolkits.setQuitHandler, quitHandler); //wrong number of arguments
} catch (IllegalAccessException|IllegalArgumentException|InvocationTargetException e) {
ConcurrentLog.logException(e);
}
*/
Switchboard.startInfoUpdater();
operation = new Op(app, host, port);

@ -3,10 +3,6 @@
* Copyright 2010 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
* First released 05.08.2010 at http://yacy.net
*
* $LastChangedDate$
* $LastChangedRevision$
* $LastChangedBy$
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@ -37,7 +33,6 @@ import javax.swing.WindowConstants;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
public class Application extends JFrame implements DocumentListener {
private static final long serialVersionUID = 1753502658600073141L;

@ -179,7 +179,7 @@ if [ $GUI -eq 1 ] #gui
then
cmdline="$cmdline -gui $parameter"
fi
if [ $DEBUG -eq 1 ] #debug
if [ $DEBUG -eq 0 ] #debug
then
cmdline=$cmdline
elif [ $LOGGING -eq 1 ];then #logging

Loading…
Cancel
Save