@Override public void addContextResourceLink(Context context, List<ApplicationResource> resourceList, boolean contextBound) { NamingResources namingResources = context.getNamingResources(); for (ContextResourceLink link : namingResources.findResourceLinks()) { ApplicationResource resource = new ApplicationResource(); logger.debug("reading resourceLink: {}", link.getName()); resource.setApplicationName(context.getName()); resource.setName(link.getName()); resource.setType(link.getType()); resource.setLinkTo(link.getGlobal()); resourceList.add(resource); } }
/** * Return a String representation of this object. */ public String toString() { StringBuffer sb = new StringBuffer("ContextResourceLink["); sb.append("name="); sb.append(getName()); if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (getGlobal() != null) { sb.append(", global="); sb.append(getGlobal()); } sb.append("]"); return (sb.toString()); }
/** * Return a String representation of this object. */ @Override public String toString() { StringBuilder sb = new StringBuilder("ContextResourceLink["); sb.append("name="); sb.append(getName()); if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (getGlobal() != null) { sb.append(", global="); sb.append(getGlobal()); } sb.append("]"); return (sb.toString()); }
/** * Return a String representation of this object. */ @Override public String toString() { StringBuilder sb = new StringBuilder("ContextResourceLink["); sb.append("name="); sb.append(getName()); if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (getGlobal() != null) { sb.append(", global="); sb.append(getGlobal()); } sb.append("]"); return (sb.toString()); }
/** * Return a String representation of this object. */ @Override public String toString() { StringBuilder sb = new StringBuilder("ContextResourceLink["); sb.append("name="); sb.append(getName()); if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (getGlobal() != null) { sb.append(", global="); sb.append(getGlobal()); } sb.append("]"); return (sb.toString()); }
/** * Return a String representation of this object. */ @Override public String toString() { StringBuilder sb = new StringBuilder("ContextResourceLink["); sb.append("name="); sb.append(getName()); if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (getGlobal() != null) { sb.append(", global="); sb.append(getGlobal()); } sb.append("]"); return (sb.toString()); }
/** * Return a String representation of this object. */ @Override public String toString() { StringBuilder sb = new StringBuilder("ContextResourceLink["); sb.append("name="); sb.append(getName()); if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (getGlobal() != null) { sb.append(", global="); sb.append(getGlobal()); } sb.append("]"); return (sb.toString()); }
/** * Add a resource link for this web application. * * @param resourceLink New resource link */ public void addResourceLink(ContextResourceLink resourceLink) { if (entries.containsKey(resourceLink.getName())) { return; } else { String value = resourceLink.getType(); if (value == null) { value = ""; } entries.put(resourceLink.getName(), value); } synchronized (resourceLinks) { resourceLink.setNamingResources(this); resourceLinks.put(resourceLink.getName(), resourceLink); } support.firePropertyChange("resourceLink", null, resourceLink); }
/** * Add a resource link for this web application. * * @param resourceLink New resource link */ public void addResourceLink(ContextResourceLink resourceLink) { if (entries.containsKey(resourceLink.getName())) { return; } else { String value = resourceLink.getType(); if (value == null) { value = ""; } entries.put(resourceLink.getName(), value); } synchronized (resourceLinks) { resourceLink.setNamingResources(this); resourceLinks.put(resourceLink.getName(), resourceLink); } support.firePropertyChange("resourceLink", null, resourceLink); }
/** * Add a resource link for this web application. * * @param resourceLink New resource link */ public void addResourceLink(ContextResourceLink resourceLink) { if (entries.containsKey(resourceLink.getName())) { return; } else { String value = resourceLink.getType(); if (value == null) { value = ""; } entries.put(resourceLink.getName(), value); } synchronized (resourceLinks) { resourceLink.setNamingResources(this); resourceLinks.put(resourceLink.getName(), resourceLink); } support.firePropertyChange("resourceLink", null, resourceLink); }
/** * Add a resource link for this web application. * * @param resourceLink New resource link */ public void addResourceLink(ContextResourceLink resourceLink) { if (entries.containsKey(resourceLink.getName())) { return; } else { Object value = resourceLink.getType(); if (value == null) { value = ""; } entries.put(resourceLink.getName(), value); } synchronized (resourceLinks) { resourceLink.setNamingResources(this); resourceLinks.put(resourceLink.getName(), resourceLink); } support.firePropertyChange("resourceLink", null, resourceLink); }
/** * Add a resource link for this web application. * * @param resource New resource link */ public void addResourceLink(ContextResourceLink resourceLink) { if (entries.containsKey(resourceLink.getName())) { return; } else { String value = resourceLink.getType(); if (value == null) { value = ""; } entries.put(resourceLink.getName(), value); } synchronized (resourceLinks) { resourceLink.setNamingResources(this); resourceLinks.put(resourceLink.getName(), resourceLink); } support.firePropertyChange("resourceLink", null, resourceLink); }
/** * Set the specified resource link in the naming context. */ public void addResourceLink(ContextResourceLink resourceLink) { // Create a reference to the resource. Reference ref = new ResourceLinkRef (resourceLink.getType(), resourceLink.getGlobal()); javax.naming.Context ctx = "UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx; try { if (logger.isDebugEnabled()) log.debug(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); ctx.bind(resourceLink.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
/** * Add a resource link for this web application. * * @param resourceLink New resource link */ public void addResourceLink(ContextResourceLink resourceLink) { if (entries.containsKey(resourceLink.getName())) { return; } else { String value = resourceLink.getType(); if (value == null) { value = ""; } entries.put(resourceLink.getName(), value); } synchronized (resourceLinks) { resourceLink.setNamingResources(this); resourceLinks.put(resourceLink.getName(), resourceLink); } support.firePropertyChange("resourceLink", null, resourceLink); // Register with JMX if (resourceRequireExplicitRegistration) { try { MBeanUtils.createMBean(resourceLink); } catch (Exception e) { log.warn(sm.getString("namingResources.mbeanCreateFail", resourceLink.getName()), e); } } }
/** * Set the specified resource link in the naming context. */ public void addResourceLink(ContextResourceLink resourceLink) { // Create a reference to the resource. Reference ref = new ResourceLinkRef (resourceLink.getType(), resourceLink.getGlobal(), resourceLink.getFactory(), null); Iterator<String> i = resourceLink.listProperties(); while (i.hasNext()) { String key = i.next().toString(); Object val = resourceLink.getProperty(key); if (val!=null) { StringRefAddr refAddr = new StringRefAddr(key, val.toString()); ref.add(refAddr); } } javax.naming.Context ctx = "UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx; try { if (logger.isDebugEnabled()) log.debug(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); ctx.bind(resourceLink.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
/** * Set the specified resource link in the naming context. */ public void addResourceLink(ContextResourceLink resourceLink) { // Create a reference to the resource. Reference ref = new ResourceLinkRef (resourceLink.getType(), resourceLink.getGlobal(), resourceLink.getFactory(), null); Iterator<String> i = resourceLink.listProperties(); while (i.hasNext()) { String key = i.next().toString(); Object val = resourceLink.getProperty(key); if (val!=null) { StringRefAddr refAddr = new StringRefAddr(key, val.toString()); ref.add(refAddr); } } javax.naming.Context ctx = "UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx; try { if (logger.isDebugEnabled()) log.debug(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); ctx.bind(resourceLink.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
/** * Set the specified resource link in the naming context. */ public void addResourceLink(ContextResourceLink resourceLink) { // Create a reference to the resource. Reference ref = new ResourceLinkRef (resourceLink.getType(), resourceLink.getGlobal(), resourceLink.getFactory(), null); Iterator<String> i = resourceLink.listProperties(); while (i.hasNext()) { String key = i.next().toString(); Object val = resourceLink.getProperty(key); if (val!=null) { StringRefAddr refAddr = new StringRefAddr(key, val.toString()); ref.add(refAddr); } } javax.naming.Context ctx = "UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx; try { if (logger.isDebugEnabled()) log.debug(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); ctx.bind(resourceLink.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
/** * Set the specified resource link in the naming context. */ public void addResourceLink(ContextResourceLink resourceLink) { // Create a reference to the resource. Reference ref = new ResourceLinkRef (resourceLink.getType(), resourceLink.getGlobal(), resourceLink.getFactory(), null); Iterator<String> i = resourceLink.listProperties(); while (i.hasNext()) { String key = i.next().toString(); Object val = resourceLink.getProperty(key); if (val!=null) { StringRefAddr refAddr = new StringRefAddr(key, val.toString()); ref.add(refAddr); } } javax.naming.Context ctx = "UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx; try { if (logger.isDebugEnabled()) log.debug(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); ctx.bind(resourceLink.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
/** * Set the specified resource link in the naming context. */ public void addResourceLink(ContextResourceLink resourceLink) { // Create a reference to the resource. Reference ref = new ResourceLinkRef (resourceLink.getType(), resourceLink.getGlobal(), resourceLink.getFactory(), null); Iterator<String> i = resourceLink.listProperties(); while (i.hasNext()) { String key = i.next().toString(); Object val = resourceLink.getProperty(key); if (val!=null) { StringRefAddr refAddr = new StringRefAddr(key, val.toString()); ref.add(refAddr); } } javax.naming.Context ctx = "UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx; try { if (logger.isDebugEnabled()) log.debug(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); ctx.bind(resourceLink.getName(), ref); } catch (NamingException e) { logger.error(sm.getString("naming.bindFailed", e)); } }
/** * Set the specified resource link in the naming context. */ public void addResourceLink(ContextResourceLink resourceLink) { // Create a reference to the resource. Reference ref = new ResourceLinkRef (resourceLink.getType(), resourceLink.getGlobal()); // Adding the additional parameters, if any addAdditionalParameters(resourceLink.getNamingResources(), ref, resourceLink.getName()); try { if (debug >= 2) log(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); envCtx.bind(resourceLink.getName(), ref); } catch (NamingException e) { String msg = MessageFormat.format(rb.getString(LogFacade.BIND_OBJECT_FAILED), e); log(msg); } }