Re: Jini+JavaSpace05 to j2ee
Nati Shalom <[email protected]> Fri, 21 Dec 2007 00:16:46 +0200
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <[email protected]> |
Luis You can simply try the steps described here: http://www.gigaspaces.com/wiki/display/GS6/Open+Spaces+Web+Container or here: http://www.gigaspaces.com/wiki/display/GS61/J2EE-JCA+-+6.0 HTH Nati S. -----Original Message----- From: Luis Arce [mailto:[email protected]] Sent: Thursday, December 20, 2007 11:26 PM To: [email protected] Subject: Jini+JavaSpace05 to j2ee Hi all, Anyone know what is the best practice for connect Jini+JavaSpace05 to j2ee (ejb,servlet or J2EE-JCA). My code is the next: public class Jini extends HttpServlet implements DiscoveryListener,LeaseListener { public void init(ServletConfig config) throws ServletException { super.init(config); try { Long tiempo=System.currentTimeMillis(); System.setSecurityManager(new RMISecurityManager()); LookupDiscovery descubrir= new LookupDiscovery(LookupDiscovery.ALL_GROUPS); descubrir.addDiscoveryListener(this); Thread.currentThread().sleep(Lease.FOREVER); } catch(RemoteException e) { System.out.println(e.toString()); } catch(Exception e) { System.out.println(e.toString()); } } public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException { PrintWriter out=response.getWriter(); out.write("Hola"); out.close(); } public void discovered(DiscoveryEvent evt) { try { ServiceRegistrar[] registrars=evt.getRegistrars(); for(int n=0;n<registrars.length;n++) { System.out.println("Descubriendo"); ServiceRegistrar registrar=registrars[n]; ServiceTemplate tmpl=new ServiceTemplate(null,new Class[] { JavaSpace05.class },null); JavaSpace05 jsprueba=(JavaSpace05)registrar.lookup(tmpl); if(jsprueba!=null) { System.out.println("Escribiendo grid"); Factura factura=new Factura(); factura.nombre="prueba1"; factura.nombre="valor1"; Entry prueba=factura; jsprueba.write(prueba,null,Long.MAX_VALUE); } } } catch(RemoteException e) { System.out.println(e.toString()); } catch(TransactionException e) { System.out.println(e.toString()); } } public void discarded(DiscoveryEvent evt) { System.out.println("Descartando "+evt.toString()); } public void notify(LeaseRenewalEvent evt) { System.out.println("Expirado"+evt.toString()); } } Best regards, Luis Arce _________________________________________________________________ Consigue aquí las mejores y mas recientes ofertas de trabajo en América Latina y USA: http://latam.msn.com/empleos/ -------------------------------------------------------------------------- Getting Started: http://www.jini.org/wiki/Category:Getting_Started Community Web Site: http://jini.org jini-users Archive: http://archives.java.sun.com/archives/jini-users.html Unsubscribing: email "signoff JINI-USERS" to [email protected] -------------------------------------------------------------------------- Getting Started: http://www.jini.org/wiki/Category:Getting_Started Community Web Site: http://jini.org jini-users Archive: http://archives.java.sun.com/archives/jini-users.html Unsubscribing: email "signoff JINI-USERS" to [email protected]