List of usage examples for javax.naming Context lookup
public Object lookup(String name) throws NamingException;
From source file:org.apache.torque.JndiConfigurationTest.java
/** * Retrieves a BasicDataSource from jndi. * @throws Exception if the jndi lookup fails or no DataSource is bound. *///from w ww. j a v a 2 s . com protected BasicDataSource retrieveDataSource() throws Exception { Context context = getInitialContext(); BasicDataSource dataSource = (BasicDataSource) context.lookup(JNDI_PATH); if (dataSource == null) { fail("DataSource should not be null"); } return dataSource; }
From source file:gov.nih.nci.cagrid.labviewer.service.globus.resource.LabLoaderResourceBase.java
public LabLoaderResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }/*from w w w . j a v a 2 s . co m*/ MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/LabLoader"; 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 = (LabLoaderResourceConfiguration) initialContext.lookup(jndiName); } catch (Exception e) { logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e); } return this.configuration; }
From source file:org.apache.torque.JndiConfigurationTest.java
/** * unbinds and closes the BasicDataSource in jndi. * @throws Exception if creation or binfding fails. *///from w w w .ja v a2 s .c om protected void unbindDataSource() throws Exception { Context context = getInitialContext(); BasicDataSource dataSource = (BasicDataSource) context.lookup(JNDI_PATH); try { if (dataSource != null) { dataSource.close(); } } finally { context.unbind(JNDI_PATH); } }
From source file:gov.nih.nci.ess.safetyreporting.tx.service.globus.resource.SafetyReportTransactionResourceBase.java
public SafetyReportTransactionResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }/*w w w .ja v a 2 s . com*/ MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/SafetyReportTransaction"; 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 = (SafetyReportTransactionResourceConfiguration) 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.iso21090.reference.service.globus.resource.ISO21090ReferenceServiceResourceBase.java
public ISO21090ReferenceServiceResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }//from w w w. j a v a2 s . co m MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/ISO21090ReferenceService"; 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 = (ISO21090ReferenceServiceResourceConfiguration) 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.notification.service.globus.resource.SafetyReportNotificationResourceBase.java
public SafetyReportNotificationResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }/* w ww . j av a 2 s . c om*/ MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/SafetyReportNotification"; 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 = (SafetyReportNotificationResourceConfiguration) 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.advquery.service.globus.resource.SafetyReportAdvancedQueryResourceBase.java
public SafetyReportAdvancedQueryResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }/*from w ww . j a va 2 s. c om*/ MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/SafetyReportAdvancedQuery"; 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 = (SafetyReportAdvancedQueryResourceConfiguration) 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.ae.service.service.globus.resource.AdverseEventEnterpriseServiceResourceBase.java
public AdverseEventEnterpriseServiceResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }//ww w . j a va 2 s .c o m MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/AdverseEventEnterpriseService"; 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 = (AdverseEventEnterpriseServiceResourceConfiguration) 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.rdquery.service.globus.resource.SafetyReportDefinitionQueryResourceBase.java
public SafetyReportDefinitionQueryResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }//from ww w . j a va 2 s . c om MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/SafetyReportDefinitionQuery"; 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 = (SafetyReportDefinitionQueryResourceConfiguration) 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.rules.service.globus.resource.SafetyReportRulesManagementResourceBase.java
public SafetyReportRulesManagementResourceConfiguration getConfiguration() { if (this.configuration != null) { return this.configuration; }//from w w w . j a va2 s.c om MessageContext ctx = MessageContext.getCurrentContext(); String servicePath = ctx.getTargetService(); servicePath = servicePath.substring(0, servicePath.lastIndexOf("/")); servicePath += "/SafetyReportRulesManagement"; 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 = (SafetyReportRulesManagementResourceConfiguration) initialContext.lookup(jndiName); } catch (Exception e) { logger.error("when performing JNDI lookup for " + jndiName + ": " + e, e); } return this.configuration; }