/** * Gets an instance of a remote JndiServiceLocator, configured by JU property files. * @return */ public static synchronized JndiServiceLocator getRemoteServiceLocator() { if (remoteServiceLocator == null) { remoteServiceLocator = ServiceLocatorBuilder.createRemoteByConfigurationFiles(); } return remoteServiceLocator; }
private ServiceLocator local() { return ServiceLocatorBuilder.createLocalByBeanManager(this.beanManager); } }
/** * Builds a remote service locator based on the values of configuration properties * using the default JU Property chain. * * @return Remote service locator */ public static JndiServiceLocator createRemoteByConfigurationFiles() { PropertyChain pc = JuUtils.getJuPropertyChain(); Integer port = pc.get("ju-util-ee.remote.port", Integer.class, true); Integer portOffset = pc.get("ju-util-ee.portOffset", Integer.class, true); return buildRemote() .remoteServer(pc.get("ju-util-ee.remote.host", true), port + portOffset) .appName(pc.get("ju-util-ee.remote.appName", true)) .moduleName(pc.get("ju-util-ee.remote.moduleName", true)) .createServiceLocator(); }
@Override protected void initVerifier(DataVerifier verifier) { if (verifier instanceof DataVerifierCdi) { ((DataVerifierCdi) verifier).init(ServiceLocatorBuilder.buildLocal().createServiceLocator()); } }
@Test public void canLookup_testFacadeBean_usingServiceLocatorBuilder() throws Exception { JndiServiceLocator loc = ServiceLocatorBuilder.buildRemote() .remoteServer("localhost", 18080) .appName("") .moduleName("test") .createServiceLocator(); // TestRemote testRemote = loc.lookup(TestRemote.class); TestRemote testRemote = loc.lookup("TestRemoteInterfaceBean!" + TestRemote.class.getName()); Assert.assertEquals("TestRemoteBean says hello to ServiceLocatorBuilder", testRemote.getGreeting("ServiceLocatorBuilder")); } }
@Override protected void initVerifier(DataVerifier verifier) { if (verifier instanceof DataVerifierCdi) { ((DataVerifierCdi) verifier).init(ServiceLocatorBuilder.buildLocal().createServiceLocator()); } }
/** * Builds a remote service locator based on the values of configuration properties * using the default JU Property chain. * * @return Remote service locator */ public static JndiServiceLocator createRemoteByConfigurationFiles() { PropertyChain pc = JuUtils.getJuPropertyChain(); Integer port = pc.get("ju-util-ee.remote.port", Integer.class, true); Integer portOffset = pc.get("ju-util-ee.portOffset", Integer.class, true); return buildRemote() .remoteServer(pc.get("ju-util-ee.remote.host", true), port + portOffset) .appName(pc.get("ju-util-ee.remote.appName", true)) .moduleName(pc.get("ju-util-ee.remote.moduleName", true)) .createServiceLocator(); }
@Override public final void init() { this.serviceLocator = ServiceLocatorBuilder.buildLocal().createServiceLocator(); this.em = this.serviceLocator.cdi(EntityManager.class); this.emUtil = new JuEmUtil(this.em); this.doInit(); }
/** * Gets an instance of a remote JndiServiceLocator, configured by JU property files. * @return */ public static synchronized JndiServiceLocator getRemoteServiceLocator() { if (remoteServiceLocator == null) { remoteServiceLocator = ServiceLocatorBuilder.createRemoteByConfigurationFiles(); } return remoteServiceLocator; }
@Test public void canLookup_testFacadeBean_usingServiceLocatorBuilder() throws Exception { JndiServiceLocator loc = ServiceLocatorBuilder.buildRemote() .remoteServer("localhost", 18080) .appName("") .moduleName("test") .createServiceLocator(); // TestRemote testRemote = loc.lookup(TestRemote.class); TestRemote testRemote = loc.lookup("TestRemoteInterfaceBean!" + TestRemote.class.getName()); Assert.assertEquals("TestRemoteBean says hello to ServiceLocatorBuilder", testRemote.getGreeting("ServiceLocatorBuilder")); } }
@Override public final void init() { this.serviceLocator = ServiceLocatorBuilder.buildLocal().createServiceLocator(); this.em = this.serviceLocator.cdi(EntityManager.class); this.emUtil = new JuEmUtil(this.em); this.doInit(); }