/** * Register access to global resources. * * @param resourceLink the resource link */ protected void registerGlobalResourceAccess(ContextResourceLink resourceLink) { ResourceLinkFactory.registerGlobalResourceAccess(ResourceResolverBean.getGlobalNamingContext(), resourceLink.getName(), resourceLink.getGlobal()); }
@Override public void addContextResourceLink(Context context, List<ApplicationResource> resourceList, boolean contextBound) { NamingResourcesImpl 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()); registerGlobalResourceAccess(link); resourceList.add(resource); } }
@Override public void addContextResourceLink(Context context, List<ApplicationResource> resourceList, boolean contextBound) { NamingResourcesImpl 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()); registerGlobalResourceAccess(link); resourceList.add(resource); } }
@Override public void addContextResourceLink(Context context, List<ApplicationResource> resourceList, boolean contextBound) { NamingResourcesImpl 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()); registerGlobalResourceAccess(link); resourceList.add(resource); } }
/** * Add a resource link for this web application. * * @param resourceLink New resource link */ @Override public void addResourceLink(ContextResourceLink resourceLink) { if (entries.contains(resourceLink.getName())) { return; } else { entries.add(resourceLink.getName()); } 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); } } }
/** * Add a resource link for this web application. * * @param resourceLink New resource link */ @Override public void addResourceLink(ContextResourceLink resourceLink) { if (entries.contains(resourceLink.getName())) { return; } else { entries.add(resourceLink.getName()); } 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); } } }
/** * Add a resource link for this web application. * * @param resourceLink New resource link */ @Override public void addResourceLink(ContextResourceLink resourceLink) { if (entries.contains(resourceLink.getName())) { return; } else { entries.add(resourceLink.getName()); } 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); } } }
/** * 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(); }
/** * Remove any resource link with the specified name. * * @param name Name of the resource link to remove */ @Override public void removeResourceLink(String name) { entries.remove(name); ContextResourceLink resourceLink = null; synchronized (resourceLinks) { resourceLink = resourceLinks.remove(name); } if (resourceLink != null) { support.firePropertyChange("resourceLink", resourceLink, null); // De-register with JMX if (resourceRequireExplicitRegistration) { try { MBeanUtils.destroyMBean(resourceLink); } catch (Exception e) { log.warn(sm.getString("namingResources.mbeanDestroyFail", resourceLink.getName()), e); } } resourceLink.setNamingResources(null); } }
/** * 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)); } }
/** * Remove any resource link with the specified name. * * @param name Name of the resource link to remove */ @Override public void removeResourceLink(String name) { entries.remove(name); ContextResourceLink resourceLink = null; synchronized (resourceLinks) { resourceLink = resourceLinks.remove(name); } if (resourceLink != null) { support.firePropertyChange("resourceLink", resourceLink, null); // De-register with JMX if (resourceRequireExplicitRegistration) { try { MBeanUtils.destroyMBean(resourceLink); } catch (Exception e) { log.warn(sm.getString("namingResources.mbeanDestroyFail", resourceLink.getName()), e); } } resourceLink.setNamingResources(null); } }
/** * Remove any resource link with the specified name. * * @param name Name of the resource link to remove */ @Override public void removeResourceLink(String name) { entries.remove(name); ContextResourceLink resourceLink = null; synchronized (resourceLinks) { resourceLink = resourceLinks.remove(name); } if (resourceLink != null) { support.firePropertyChange("resourceLink", resourceLink, null); // De-register with JMX if (resourceRequireExplicitRegistration) { try { MBeanUtils.destroyMBean(resourceLink); } catch (Exception e) { log.warn(sm.getString("namingResources.mbeanDestroyFail", resourceLink.getName()), e); } } resourceLink.setNamingResources(null); } }
"UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx; try { if (log.isDebugEnabled()) log.debug(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); ctx.bind(resourceLink.getName(), ref); } catch (NamingException e) { log.error(sm.getString("naming.bindFailed", e)); getGlobalNamingContext(), resourceLink.getName(), resourceLink.getGlobal());
"UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx; try { if (log.isDebugEnabled()) log.debug(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); ctx.bind(resourceLink.getName(), ref); } catch (NamingException e) { log.error(sm.getString("naming.bindFailed", e)); getGlobalNamingContext(), resourceLink.getName(), resourceLink.getGlobal());
} catch (Exception e) { log.warn(sm.getString( "namingResources.mbeanDestroyFail", crl.getName()), e);
} catch (Exception e) { log.warn(sm.getString( "namingResources.mbeanCreateFail", crl.getName()), e);
} catch (Exception e) { log.warn(sm.getString( "namingResources.mbeanCreateFail", crl.getName()), e);
} catch (Exception e) { log.warn(sm.getString( "namingResources.mbeanCreateFail", crl.getName()), e);