For T5.4: http://jumpstart.doublenegative.com.au/jumpstart7/examples/state/atejb
Soon I'll modify EJBProviderUtil to read a system property provided at runtime (eg. -Djumpstart.ejb-provider=OPENEJB_4_LOCAL), because it's getting too hard to keep EJBProviderUtil's detection technique working reliably. public static EJBProviderEnum detectEJBProvider(Logger logger) { EJBProviderEnum ejbProvider = null; String ejbProviderStr = null; try { ejbProviderStr = System.getProperty(PROPERTY_EJB_PROVIDER); if (ejbProviderStr == null) { throw new IllegalStateException("System property \"" + PROPERTY_EJB_PROVIDER + "\" not found. Please set it to one of: {" + getAllowedValuesAsStr() + "}."); } ejbProvider = EJBProviderEnum.valueOf(ejbProviderStr); } catch (IllegalStateException e) { throw e; } catch (SecurityException e) { throw new IllegalStateException("Failed to get system property \"" + PROPERTY_EJB_PROVIDER + "\": " + e); } catch (Exception e) { throw new IllegalStateException("Found system property \"" + PROPERTY_EJB_PROVIDER + "\" equals \"" + ejbProviderStr + "\", expected one of: {" + getAllowedValuesAsStr() + "}."); } return ejbProvider; } private static String getAllowedValuesAsStr() { String valuesStr = ""; EJBProviderEnum[] values = EJBProviderEnum.values(); for (EJBProviderEnum ejbProviderEnum : values) { valuesStr += "\"" + ejbProviderEnum.name() + "\", "; } return valuesStr.substring(0, valuesStr.lastIndexOf(",")); } Geoff On 30 Mar 2015, at 7:43 pm, Chris Mylonas <ch...@opencsta.org> wrote: > http://jumpstart.doublenegative.com.au/jumpstart/ > > & > > http://jumpstart.doublenegative.com.au/jumpstart/examples/state/atejb > > Download jumpstart and have a look how Geoff has done it. > > > > > > > On Mon, 30 Mar 2015 19:34:29 +1100, Adam X <vbgnm3c...@gmail.com> wrote: > >> Hi, >> >> I have a different JNDI lookup depending on exec env. I have an AppModule >> with EJB sub: >> >> @SubModule(EjbModule.class) >> AppModule >> >> And my EJB mod does all the EJB plumbing building the context and >> delegating the looking up of EJBs to EjbLocatorModule. As far as building >> my beans I would like to inject JNDI into my EJB builder methods as a >> symbol: >> >> @SubModule(EjbLocatorModule.class) >> EjbModule { >> // builds EjbContext and stuff >> } >> >> EjbLocatorModule.java: >> >> public RegistrationDaoRemote buildRegistrationService( >> @InjectService("EjbContext") Context aEjbContext, >> @Inject @Value("${ejb.jndi.dao.registration}") String jndi) >> { >> // remote EJB dao lookup >> } >> >> So the symbol ${ejb.jndi.dao.registration} is different depending on >> execution environmnet (prod, readiness, dev, local) >> >> How it's best done in Tapestry? >> >> * if-then-else in a single contribution method testing -D JVM arg? (ugly) >> * different -D exec mode and different modules ? (will the contribution >> load before submodule of the app module will) ? >> * introduce another property file with a manual lookup? >> >> Or yet a better solution? Please advise. >> >> Adam > > > -- > Using Opera's mail client: http://www.opera.com/mail/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org >