List of usage examples for javax.naming Context lookup
public Object lookup(String name) throws NamingException;
From source file:com.netcracker.tss.web.servlet.customer.CustomerMMGServiceServlet.java
private MeetMyGuestBeanLocal getMeetMyGuestBean(HttpServletRequest req) { Context context; try {/*from w w w .j a va2 s . c o m*/ context = new InitialContext(); MeetMyGuestBeanLocalHome meetMyGuestBeanLocalHome = (MeetMyGuestBeanLocalHome) context .lookup("java:app/tss-ejb/MeetMyGuestBean!com.netcracker.ejb.MeetMyGuestBeanLocalHome"); return meetMyGuestBeanLocalHome.create(); } catch (NamingException ex) { Logger.getLogger(AdminGroupServlet.class.getName()).log(Level.SEVERE, "Can't find userBean with name java:app/tss-ejb/UserBean!com.netcracker.ejb.MeetMyGuestBeanLocal ", ex); throw new RuntimeException("Internal server error!");// maybe have // to create // custom // exception? } }
From source file:gov.nih.nci.cdmsconnector.c3d.service.globus.resource.C3DGridServiceResourceBase.java
public C3DGridServiceResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }// ww w. j av a2s. c om MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/C3DGridService"; String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration"; logger.debug("Will read configuration from jndi name: " + jndiName); try { Context initialContext = new InitialContext(); this.configuration = (C3DGridServiceResourceConfiguration) initialContext.lookup(jndiName); } catch (Exception e) { logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e); } return this.configuration; }
From source file:gov.nih.nci.ess.safetyreporting.management.service.globus.resource.SafetyReportManagementResourceBase.java
public SafetyReportManagementResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }/* w ww .j a va2 s. c om*/ MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/SafetyReportManagement"; String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration"; logger.debug("Will read configuration from jndi name: " + jndiName); try { Context initialContext = new InitialContext(); this.configuration = (SafetyReportManagementResourceConfiguration) initialContext.lookup(jndiName); } catch (Exception e) { logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e); } return this.configuration; }
From source file:gov.nih.nci.caarray.services.external.v1_0.grid.service.globus.resource.CaArraySvc_v1_0ResourceBase.java
public CaArraySvc_v1_0ResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }// w w w . j ava 2 s . com MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/CaArraySvc_v1_0"; String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration"; logger.debug("Will read configuration from jndi name: " + jndiName); try { Context initialContext = new InitialContext(); this.configuration = (CaArraySvc_v1_0ResourceConfiguration) initialContext.lookup(jndiName); } catch (Exception e) { logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e); } return this.configuration; }
From source file:gov.nih.nci.cagrid.caarray.service.globus.resource.CaArraySvcResourceBase.java
public CaArraySvcResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }//from w w w .java 2s. co m MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/CaArraySvc"; String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration"; logger.debug("Will read configuration from jndi name: " + jndiName); try { Context initialContext = new InitialContext(); this.configuration = (CaArraySvcResourceConfiguration) initialContext.lookup(jndiName); } catch (Exception e) { logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e); } return this.configuration; }
From source file:gov.nih.nci.clinicalconnector.service.globus.resource.ClinicalConnectorResourceBase.java
public ClinicalConnectorResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }// w w w . j ava 2s . c o m MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/ClinicalConnector"; String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration"; logger.debug("Will read configuration from jndi name: " + jndiName); try { Context initialContext = new InitialContext(); this.configuration = (ClinicalConnectorResourceConfiguration) initialContext.lookup(jndiName); } catch (Exception e) { logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e); } return this.configuration; }
From source file:org.eclipse.smila.connectivity.queue.AbstractBrokerPropertiesConfigImpl.java
/** * {@inheritDoc}//from w ww . j a va2 s.c om * * @see org.eclipse.smila.connectivity.queue.ConnectivityBroker#start() */ public synchronized void start() throws BrokerException { Properties properties; try { properties = loadJMSProperties(); } catch (final Exception e) { throw new BrokerException("Unable to load JMS properties", e); } Context ctx; try { ctx = new InitialContext(properties); System.setProperty(PROPERTY_DEFAULT_DIRECTORY_PREFIX, properties.getProperty(PROPERTY_DEFAULT_DIRECTORY_PREFIX)); final ConnectionFactory factory = (ConnectionFactory) ctx.lookup("ConnectionFactory"); _connection = factory.createConnection(); _connection.start(); _session = _connection.createSession(true, Session.SESSION_TRANSACTED); _session.createQueue(DLQ); } catch (final Exception e) { throw new BrokerException("Error initializing Queue Broker with JMS properties resp. configuration", e); } finally { if (_session != null) { try { _session.commit(); } catch (final JMSException e) { ;// nothing } try { _session.close(); } catch (final JMSException e) { ;// nothing } } } }
From source file:gov.nih.nci.ess.safetyreporting.qry.service.globus.resource.SafetyReportQueryResourceBase.java
public SafetyReportQueryResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }/*from ww w. java 2 s . com*/ MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/SafetyReportQuery"; String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration"; logger.debug("Will read configuration from jndi name: " + jndiName); try { Context initialContext = new InitialContext(); this.configuration = (SafetyReportQueryResourceConfiguration) initialContext.lookup(jndiName); } catch (Exception e) { logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e); } return this.configuration; }
From source file:org.firstopen.singularity.util.HibernateUtilImpl.java
/** * Returns the SessionFactory used for this class. * // ww w. j ava2 s . co m * @return SessionFactory * @ */ public SessionFactory getSessionFactory() { SessionFactory sessionFactory = getSessionFactoryManager().sessionFactory; if (sessionFactory == null) { try { Context ctx = JNDIUtil.getInitialContext(); sessionFactory = (SessionFactory) ctx.lookup(jndiName); getSessionFactoryManager().sessionFactory = sessionFactory; } catch (NamingException ex) { sessionFactory = getStandAloneSessionFactory(); if (sessionFactory == null) { throw new InfrastructureException(ex); } } } return sessionFactory; }
From source file:gov.nih.nci.ess.safetyreporting.review.service.globus.resource.SafetyReportReviewResourceBase.java
public SafetyReportReviewResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }/* w ww.j a va 2s .c o m*/ MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/SafetyReportReview"; String jndiName = Constants.JNDI_SERVICES_BASE_NAME + servicePath + "/configuration"; logger.debug("Will read configuration from jndi name: " + jndiName); try { Context initialContext = new InitialContext(); this.configuration = (SafetyReportReviewResourceConfiguration) initialContext.lookup(jndiName); } catch (Exception e) { logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e); } return this.configuration; }