Guest User

Untitled

a guest
Jan 10th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. Context context = new InitialContext();
  2.  
  3. final String appName = "TesteModuloPagamentoCliente-ear-1.0-SNAPSHOT";
  4. final String moduleName = "TesteModuloPagamentoCliente-ejb-1.0-SNAPSHOT";
  5. final String distinctName = "";
  6. final String beanName = "RegraPagamentoCliente1";
  7.  
  8. final String viewClassName = IFlexibleRuleRemote.class.getName();
  9.  
  10. String ejbName = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName;
  11.  
  12. System.out.println("Looking EJB via JNDI ");
  13. System.out.println(ejbName);
  14.  
  15. IFlexibleRuleRemote regraPagamentoRemoto = (IFlexibleRuleRemote) context.lookup(ejbName);
  16.  
  17. if (regraPagamentoRemoto.isOnline()) {
  18. return regraPagamentoRemoto;
  19. } else {
  20. return regraPagamentoAplicacao;
  21. }
  22.  
  23. Context context = new InitialContext();
  24. String jndiName = "ejb:TesteModuloPagamentoCliente-ear-1.0-SNAPSHOT/TesteModuloPagamentoCliente-ejb-1.0-SNAPSHOT//RegraPagamentoCliente1!br.com.silas.tail.pagamentoutil.IFlexibleRuleRemote";
  25.  
  26. FlexibleRuleRemoteI i = (FlexibleRuleRemoteI) context.lookup(jndiName);
  27. System.out.println("sldfkasfd " + i.isOnline());
  28. return (T) i;
  29.  
  30. java.naming.factory.url.pkgs=org.jboss.ejb.client.naming
  31.  
  32. endpoint.name=TesteModuloPagamentoCliente-ear-1.0-SNAPSHOT
  33. remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
  34. remote.connections=default
  35. remote.connection.default.host=127.0.0.1
  36. remote.connection.default.port=6060
  37. remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
  38. remote.connection.default.username=remote
  39. remote.connection.default.password=remote
  40.  
  41. @Remote(value = FlexibleRuleRemoteI.class)
  42. @Stateless
  43. public class RegraPagamentoCliente1 implements IFlexibleRuleRemote, Serializable {
  44.  
  45. private static final long serialVersionUID = 1L;
  46.  
  47. @Override
  48. public void run(Object object) {
  49. System.out.println("Oi eu sou o servidor " + object.toString());
  50. }
  51.  
  52. @Override
  53. public boolean isOnline() {
  54. return true;
  55. }
  56.  
  57. }
  58.  
  59. package br.com.silas.tail.pagamentoutil;
  60.  
  61. public interface IFlexibleRuleRemote {
  62.  
  63. public boolean isOnline();
  64.  
  65. public void run(Object object);
  66.  
  67. }
Add Comment
Please, Sign In to add comment