Switch to WinRun4J for Windows service wrapper

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1947 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2012-04-23 21:25:52 +00:00
parent 2ae4ed602e
commit 77a478121a
7 changed files with 93 additions and 1 deletions

View File

@ -104,6 +104,8 @@
<include name="*.jar"/>
<include name="*.jnilib"/>
<exclude name="swt*.jar"/>
<exclude name="junit-*.jar"/>
<exclude name="winrun4j-*.jar"/>
</jarfileset>
</jarbundler>
<!-- prepare hide from dock option -->
@ -267,7 +269,8 @@
classpathref="classpath"/>
<jsmoothgen project="davmail.jsmooth" skeletonroot="src/jsmooth/skeletons"/>
<jsmoothgen project="davmailconsole.jsmooth" skeletonroot="src/jsmooth/skeletons"/>
<jsmoothgen project="davmailservice.jsmooth" skeletonroot="src/jsmooth/skeletons"/>
<!-- use WinRun4J to generate DavMail service -->
<copy file="src/winrun4j/davmailservice.exe" todir="dist"/>
<jsmoothgen project="davmail64.jsmooth" skeletonroot="src/jsmooth/skeletons"/>
<zip file="dist/davmail-${release-name}.zip">
<fileset dir="dist">
@ -279,6 +282,7 @@
<exclude name="lib/swt*.jar"/>
<exclude name="lib/libgrowl-*.jar"/>
<exclude name="lib/junit-*.jar"/>
<exclude name="lib/winrun4j-*.jar"/>
</fileset>
</zip>
<copy todir="dist/web">

View File

@ -104,6 +104,7 @@ Section "MainSection" SEC01
File "dist\lib\stax2-api-3.1.1.jar"
File "dist\lib\swt-3.7-win32-x86.jar"
File "dist\lib\swt-3.7-win32-x86_64.jar"
File "dist\lib\winrun4j-0.4.4.jar"
File "dist\lib\woodstox-core-asl-4.1.2.jar"
File "dist\lib\xercesImpl-2.8.1.jar"
@ -178,6 +179,7 @@ no_quest:
Delete "$INSTDIR\lib\stax2-api-3.1.1.jar"
Delete "$INSTDIR\lib\swt-3.7-win32-x86.jar"
Delete "$INSTDIR\lib\swt-3.7-win32-x86_64.jar"
Delete "$INSTDIR\lib\winrun4j-0.4.4.jar"
Delete "$INSTDIR\lib\woodstox-core-asl-4.1.2.jar"
Delete "$INSTDIR\lib\xercesImpl-2.8.1.jar"

BIN
lib/winrun4j-0.4.4.jar Normal file

Binary file not shown.

View File

@ -0,0 +1,71 @@
/*
* DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
* Copyright (C) 2009 Mickael Guessant
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package davmail.service;
import davmail.BundleMessage;
import davmail.DavGateway;
import davmail.Settings;
import davmail.ui.tray.DavGatewayTray;
import org.boris.winrun4j.AbstractService;
import org.boris.winrun4j.ServiceException;
/**
* WinRun4J DavMail service.
*/
public class DavService extends AbstractService {
/**
* Perform a service request.
*
* @param control service control.
* @return return code.
* @throws ServiceException on error.
*/
@Override
public int serviceRequest(int control) throws ServiceException {
switch (control) {
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
DavGatewayTray.debug(new BundleMessage("LOG_STOPPING_DAVMAIL"));
DavGateway.stop();
}
return 0;
}
/**
* Run the service.
*
* @param args command line arguments
* @return return code
* @throws ServiceException on error
*/
public int serviceMain(String[] args) throws ServiceException {
if (args.length >= 1) {
Settings.setConfigFilePath(args[0]);
}
Settings.load();
DavGatewayTray.init();
DavGateway.start();
DavGatewayTray.debug(new BundleMessage("LOG_DAVMAIL_STARTED"));
return 0;
}
}

Binary file not shown.

View File

@ -0,0 +1,15 @@
service.startup=auto
service.class=davmail.service.DavService
service.id=DavMail
service.name=DavMail Gateway
service.description=DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange Gateway
classpath.1=davmail.jar
classpath.2=lib/*
vm.version.min=1.6
vmarg.1=-Dsun.net.inetaddr.ttl=60
vmarg.2=-Xrs
arg.1=davmail.properties

BIN
src/winrun4j/rcedit.exe Normal file

Binary file not shown.