java - Swing, serial port and JSF -
i need , idea resolve situation: made swing application capture data on serial port, capture fires alarms (rendered in jpane) , @ same time info stored in database supply statisticals (using jfreechart , jasperreports). now, want present same information in web base interface , thinking in jsf + primefaces on apache tomcat 7 application.
the statisticals it´s not problem, our concern how notify web application event fire in serial port show same alarm captures made swing app showed in client's browser?. final user wants mantain both formats: local view (swing) , web view manager purposes.
are our propose correct 1 (swing -> jsf + primefaces)?, there other alternatives?
thanks in advances idea
i found way resolve problem. left here solution found it, first: 1. test solution used glassfish 3.1.2.2 instead of tomcat 7, netbeans 7.3 , primefaces 3.5 2. made sample application based on tutorial. 3. implemented pimepush counter example of primefaces demo page. 4. made swing application, button simulated action of serial port capture, app use ws push content in web application. 5. gf has comet , web sockets support enabled.
but there's problem, every time restart glassfish, it´s necessary undeploy application , them redeploy again in order web service avalaible. why this?, missing somethig?
here code:
the ws class:
@webservice(servicename = "botonservice") @stateless public class botonservice { private boolean push = false; @ejb private serviceshare servicio; /** * sample web service operation */ @webmethod(operationname = "hello") public string hello(@webparam(name = "name") string txt) { return "hello " + txt + " !"; } /** * web service operation */ @webmethod(operationname = "setpush") public void setpush(@webparam(name = "push") boolean push) { this.push = push; servicio.setpush(push); servicio.firepush(); } /** * web service operation */ @webmethod(operationname = "getpush") public boolean getpush() { return this.push; } } here managedbean class:
@stateless @managedbean(name = "globalcounter") @applicationscoped public class globalcounterbean implements serializable { private int count; private string channel = "/counter"; public int getcount() { return count; } public void setcount(int count) { this.count = count; } public synchronized void increment() { count++; pushcontext pushcontext = pushcontextfactory.getdefault().getpushcontext(); pushcontext.push(channel, string.valueof(count)); } } and here ejb used communicate ws managedbean:
@stateless public class serviceshare { @ejb private globalcounterbean counter; private boolean push = false; public boolean getpush() { return push; } public void setpush(boolean push){ this.push = push; } public void firepush(){ if(this.push){ counter.increment(); } } } the jsf page same in primefaces demo.
every time push button in swing application made it, counter updated in each machine connected, that´s idea of final application. again, why have redeploy web application in order ws-client in swing application find it?. there configuration i'm missing in gf server avoid behaviour?
Comments
Post a Comment