// license-header java merge-point // // Attention: Generated code! Do not modify by hand! // Generated by ServiceLocator.vsl in andromda-ejb3-cartridge on 09/18/2014 16:56:08. // package org.andromda.test; import java.util.Properties; import javax.naming.InitialContext; import javax.naming.NamingException; import org.andromda.test.howto10.a.PaymentServiceRemote; import org.andromda.test.howto10.a.RentalServiceRemote; import org.andromda.test.howto18.a.UserEndPointServiceRemote; import org.andromda.test.howto18.a.UserServiceRemote; /** * Locates and provides all available application services. */ public class ServiceLocator { /** * The shared instance of this ServiceLocator. */ private static ServiceLocator instance; /** * The Context to lookup the service beans. */ protected InitialContext context = null; /** * Cannot be instantiated constructor */ private ServiceLocator() { // shouldn't be instantiated } /** * Gets the instance of this Class. * Create it if doesn't already exist, otherwise return the current instance. * * @return the shared service locator instance. */ public static final ServiceLocator getInstance() { if (instance == null) { instance = new ServiceLocator(); } return instance; } /** * Gets the InitialContext. * * @param env the Context environment properties. * @return the InitialContext. * @throws NamingException failure to create InitialContext */ protected synchronized InitialContext getContext(Properties env) throws NamingException { if (this.context == null) { this.context = new InitialContext(env); } return this.context; } /** * Instantiate a new InitialContext using the properties table. * * @param env passed to the InitialContext constructor. * @return the InitialContext. * @throws NamingException failure to create InitialContext */ protected synchronized InitialContext newContext(Properties env) throws NamingException { this.context = new InitialContext(env); return this.context; } /** * Shuts down the ServiceLocator and releases any used resources. */ public synchronized void shutdown() { if (this.context != null) { try { this.context.close(); } catch (NamingException ne) { // ignore } finally { this.context = null; } } } /** * Gets the remote interface {@link org.andromda.test.howto3.a.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto3.a.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto3.a.RentalServiceRemote get_org_andromda_test_howto3_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto3.a.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto3.b.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto3.b.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto3.b.RentalServiceRemote get_org_andromda_test_howto3_b_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto3.b.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto4.a.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto4.a.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto4.a.RentalServiceRemote get_org_andromda_test_howto4_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto4.a.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto4.b.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto4.b.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto4.b.RentalServiceRemote get_org_andromda_test_howto4_b_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto4.b.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto5.a.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto5.a.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto5.a.RentalServiceRemote get_org_andromda_test_howto5_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto5.a.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto6.a.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto6.a.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto6.a.RentalServiceRemote get_org_andromda_test_howto6_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto6.a.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto7.a.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto7.a.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto7.a.RentalServiceRemote get_org_andromda_test_howto7_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto7.a.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto8.b.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto8.b.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto8.b.RentalServiceRemote get_org_andromda_test_howto8_b_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto8.b.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto9.a.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto9.a.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto9.a.RentalServiceRemote get_org_andromda_test_howto9_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto9.a.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto9.b.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto9.b.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto9.b.RentalServiceRemote get_org_andromda_test_howto9_b_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto9.b.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final RentalServiceRemote get_org_andromda_test_howto10_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link PaymentServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return PaymentServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final PaymentServiceRemote get_org_andromda_test_howto10_a_PaymentServiceBean_Remote(Properties env) throws NamingException { return (PaymentServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/PaymentServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto11.a.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto11.a.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto11.a.RentalServiceRemote get_org_andromda_test_howto11_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto11.a.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto16.a.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto16.a.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto16.a.RentalServiceRemote get_org_andromda_test_howto16_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto16.a.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link org.andromda.test.howto13.a.RentalServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return org.andromda.test.howto13.a.RentalServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final org.andromda.test.howto13.a.RentalServiceRemote get_org_andromda_test_howto13_a_RentalServiceBean_Remote(Properties env) throws NamingException { return (org.andromda.test.howto13.a.RentalServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/RentalServiceBean/remote"); } /** * Gets the remote interface {@link UserServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return UserServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final UserServiceRemote get_org_andromda_test_howto18_a_UserServiceBean_Remote(Properties env) throws NamingException { return (UserServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/UserServiceBean/remote"); } /** * Gets the remote interface {@link UserEndPointServiceRemote}. * * @param env the Context environment properties. Null represents no properties. * @return UserEndPointServiceRemote * @throws NamingException failure to lookup remote service interface. */ public final UserEndPointServiceRemote get_org_andromda_test_howto18_a_UserEndPointServiceBean_Remote(Properties env) throws NamingException { return (UserEndPointServiceRemote) getContext(env).lookup("howtomodel-1.0-SNAPSHOT/UserEndPointServiceBean/remote"); } /** * Gets an instance of the given service. * * @param serviceName lookup this service from the context. * @return Object getService(serviceName, null) * @throws NamingException failure to lookup remote service interface. */ public final Object getService(String serviceName) throws NamingException { return getService(serviceName, null); } /** * Gets an instance of the given service. * * @param serviceName lookup this service from the context. * @param env the Context environment properties. Null represents no properties. * @return Object getContext(env).lookup(serviceName) * @throws NamingException failure to lookup remote service interface. */ public final Object getService(String serviceName, Properties env) throws NamingException { return getContext(env).lookup(serviceName); } }