|
From: Barry A. <tit...@gm...> - 2007-12-21 14:19:02
|
Thanks for the info Leif. I think this is what I am looking for. Would a normal User be able to communicate with a service running under Admin? I know that a normal User cannot stop/start/pause a service so I would think it's also a problem to communicate any special event. thanks, -B On Dec 21, 2007 12:35 AM, Leif Mortenson <le...@ta...> wrote: > Barry, > It depends on exactly what it is that you want to trigger. > Is it a life cycle action of the Wrapper to to start a piece of > arbitrary code in your server. > > I assume the later. > > 1) The Wrapper allows you to capture and react to user defined > service control codes by registering a WrapperEventListener > using the following method call: > WrapperManager.addWrapperEventListener(l, > WrapperEventListener.EVENT_FLAG_SERVICE); > Your listener will then receive WrapperServiceControlEvents > whenever your service receives any control code, including user > codes. > The drawback here is with the ability to easily send those > custom codes. Do you know of a way to do it from the command > prompt? > > 2) The way I have done it in the past is to use the WrapperActionServer > class. This creates a very simple telnet server which receives one > character commands and then immediately closes the connections. > It comes with a number of predefined commands, but you can also > register your own using the registerAction method which takes the > trigger character and a Runnable instance. > A sample code fragment can be found in the javadocs for > WrapperActionServer. > > This solution works nicely as you can control it from anywhere > by simply using a telnet client. The drawback is that it is not very > secure as currently implemented. That could be resolved by adding > Passwords, IP masks etc, but it is not in there at the moment. > > See the javadocs for documentation on all of the above: > http://wrapper.tanukisoftware.org/doc/english/javadocs.html > > Cheers, > Leif > > Barry Andrews wrote: > > Hi All, > > > > I am in the process of evaluating Java Service Wrapper for Windows and I > > am wondering if there is a built in way to communicate to a wrapped > > service? > > > > I have some code that I need to run as a Windows service and I need to > > be able to communicate to it from another process and tell it to run. On > > Windows you have you have the ServiceBase.OnCustomCommand listener. > > > > I have thought about different ways to communicate this event to the > > service. One way is programmatically pausing the service, ( "net pause > > <service name>" ) and continuing it when I need it to run. The problem > > with this is it needs to work for someone logged in as a regular "User", > > not just an admin. The service would have admin privileges, but the > > program may only have User privileges. > > > > I also thought about communicating via ports, but I didn't know if there > > was some communication functionality already built in that I was just > > overlooking? Any thoughts on this? > > > > Many thanks to you all. > > > > -B > > > > > ------------------------------------------------------------------------- > > SF.Net email is sponsored by: > > Check out the new SourceForge.net Marketplace. > > It's the best place to buy or sell services > > for just about anything Open Source. > > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > > _______________________________________________ > > Wrapper-user mailing list > > Wra...@li... > > https://lists.sourceforge.net/lists/listinfo/wrapper-user > > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Wrapper-user mailing list > Wra...@li... > https://lists.sourceforge.net/lists/listinfo/wrapper-user > |