@Override public void addContextResource(Context context, List<ApplicationResource> resourceList, boolean contextBound) { NamingResources namingResources = context.getNamingResources(); for (ContextResource contextResource : namingResources.findResources()) { ApplicationResource resource = new ApplicationResource(); logger.info("reading resource: {}", contextResource.getName()); resource.setApplicationName(context.getName()); resource.setName(contextResource.getName()); resource.setType(contextResource.getType()); resource.setScope(contextResource.getScope()); resource.setAuth(contextResource.getAuth()); resource.setDescription(contextResource.getDescription()); resourceList.add(resource); } }
/** * Return a String representation of this object. */ @Override public String toString() { StringBuilder sb = new StringBuilder("ContextResource["); sb.append("name="); sb.append(getName()); if (getDescription() != null) { sb.append(", description="); sb.append(getDescription()); } if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (auth != null) { sb.append(", auth="); sb.append(auth); } if (scope != null) { sb.append(", scope="); sb.append(scope); } sb.append("]"); return (sb.toString()); }
/** * Return a String representation of this object. */ @Override public String toString() { StringBuilder sb = new StringBuilder("ContextResource["); sb.append("name="); sb.append(getName()); if (getDescription() != null) { sb.append(", description="); sb.append(getDescription()); } if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (auth != null) { sb.append(", auth="); sb.append(auth); } if (scope != null) { sb.append(", scope="); sb.append(scope); } sb.append("]"); return (sb.toString()); }
/** * Return a String representation of this object. */ @Override public String toString() { StringBuilder sb = new StringBuilder("ContextResource["); sb.append("name="); sb.append(getName()); if (getDescription() != null) { sb.append(", description="); sb.append(getDescription()); } if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (auth != null) { sb.append(", auth="); sb.append(auth); } if (scope != null) { sb.append(", scope="); sb.append(scope); } sb.append("]"); return (sb.toString()); }
/** * Return a String representation of this object. */ @Override public String toString() { StringBuilder sb = new StringBuilder("ContextResource["); sb.append("name="); sb.append(getName()); if (getDescription() != null) { sb.append(", description="); sb.append(getDescription()); } if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (auth != null) { sb.append(", auth="); sb.append(auth); } if (scope != null) { sb.append(", scope="); sb.append(scope); } sb.append("]"); return (sb.toString()); }
/** * Return a String representation of this object. */ public String toString() { StringBuffer sb = new StringBuffer("ContextResource["); sb.append("name="); sb.append(getName()); if (getDescription() != null) { sb.append(", description="); sb.append(getDescription()); } if (getType() != null) { sb.append(", type="); sb.append(getType()); } if (auth != null) { sb.append(", auth="); sb.append(auth); } if (scope != null) { sb.append(", scope="); sb.append(scope); } sb.append("]"); return (sb.toString()); }
/** * Add a resource reference for this web application. * * @param resource New resource reference */ public void addResource(ContextResource resource) { if (entries.containsKey(resource.getName())) { return; } else { entries.put(resource.getName(), resource.getType()); } synchronized (resources) { resource.setNamingResources(this); resources.put(resource.getName(), resource); } support.firePropertyChange("resource", null, resource); }
/** * Add a resource reference for this web application. * * @param resource New resource reference */ public void addResource(ContextResource resource) { if (entries.containsKey(resource.getName())) { return; } else { entries.put(resource.getName(), resource.getType()); } synchronized (resources) { resource.setNamingResources(this); resources.put(resource.getName(), resource); } support.firePropertyChange("resource", null, resource); }
/** * Add a resource reference for this web application. * * @param resource New resource reference */ public void addResource(ContextResource resource) { if (entries.containsKey(resource.getName())) { return; } else { entries.put(resource.getName(), resource.getType()); } synchronized (resources) { resource.setNamingResources(this); resources.put(resource.getName(), resource); } support.firePropertyChange("resource", null, resource); }
/** * Add a resource reference for this web application. * * @param resource New resource reference */ public void addResource(ContextResource resource) { if (entries.containsKey(resource.getName())) { return; } else { entries.put(resource.getName(), resource.getType()); } synchronized (resources) { resource.setNamingResources(this); resources.put(resource.getName(), resource); } support.firePropertyChange("resource", null, resource); }
/** * Add a resource reference for this web application. * * @param resource New resource reference */ public void addResource(ContextResource resource) { if (entries.containsKey(resource.getName())) { return; } else { entries.put(resource.getName(), resource.getType()); } synchronized (resources) { resource.setNamingResources(this); resources.put(resource.getName(), resource); } support.firePropertyChange("resource", null, resource); }
public void addResource(ContextResource resource) { try { Context globalNamingContext = standardServer.getGlobalNamingContext(); Object value = globalNamingContext.lookup(resource.getName()); String type = resource.getType(); bindResource(resource.getName(), value, type); } catch (NamingException e) { logger.error("Unable to lookup Global Tomcat resource " + resource.getName(), e); } }
/** * Deregister the MBean for this * <code>ContextResource</code> object. * * @param resource The ContextResource to be managed * * @exception Exception if an MBean cannot be deregistered */ public static void destroyMBean(ContextResource resource) throws Exception { // If this is a user database resource need to destroy groups, roles, // users and UserDatabase mbean if ("org.apache.catalina.UserDatabase".equals(resource.getType())) { destroyMBeanUserDatabase(resource.getName()); } String mname = createManagedName(resource); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, resource); if( mserver.isRegistered(oname )) mserver.unregisterMBean(oname); }
/** * Deregister the MBean for this * <code>ContextResource</code> object. * * @param resource The ContextResource to be managed * * @exception Exception if an MBean cannot be deregistered */ static void destroyMBean(ContextResource resource) throws Exception { // If this is a user database resource need to destroy groups, roles, // users and UserDatabase mbean if ("org.apache.catalina.UserDatabase".equals(resource.getType())) { destroyMBeanUserDatabase(resource.getName()); } String mname = createManagedName(resource); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, resource); if( mserver.isRegistered(oname )) mserver.unregisterMBean(oname); }
/** * Add a resource reference for this web application. * * @param resource New resource reference */ public void addResource(ContextResource resource) { if (entries.containsKey(resource.getName())) { return; } else { entries.put(resource.getName(), resource.getType()); } synchronized (resources) { resource.setNamingResources(this); resources.put(resource.getName(), resource); } support.firePropertyChange("resource", null, resource); // Register with JMX if (resourceRequireExplicitRegistration) { try { MBeanUtils.createMBean(resource); } catch (Exception e) { log.warn(sm.getString("namingResources.mbeanCreateFail", resource.getName()), e); } } }
if (container instanceof Server) { name = new ObjectName(domain + ":type=Resource" + ",resourcetype=Global,class=" + resource.getType() + ",name=" + quotedResourceName); } else if (container instanceof Context) { ",resourcetype=Context,context=" + cn.getDisplayName() + ",host=" + host.getName() + ",class=" + resource.getType() + ",name=" + quotedResourceName);
/** * Deregister the MBean for this * <code>ContextResource</code> object. * * @param resource The ContextResource to be managed * * @exception Exception if an MBean cannot be deregistered */ static void destroyMBean(ContextResource resource) throws Exception { // If this is a user database resource need to destroy groups, roles, // users and UserDatabase mbean if ("org.apache.catalina.UserDatabase".equals(resource.getType())) { destroyMBeanUserDatabase(resource.getName()); } String mname = createManagedName(resource); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, resource); if( mserver.isRegistered(oname )) mserver.unregisterMBean(oname); }
/** * Deregister the MBean for this * <code>ContextResource</code> object. * * @param resource The ContextResource to be managed * * @exception Exception if an MBean cannot be deregistered */ static void destroyMBean(ContextResource resource) throws Exception { // If this is a user database resource need to destroy groups, roles, // users and UserDatabase mbean if ("org.apache.catalina.UserDatabase".equals(resource.getType())) { destroyMBeanUserDatabase(resource.getName()); } String mname = createManagedName(resource); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, resource); if( mserver.isRegistered(oname )) mserver.unregisterMBean(oname); }
/** * Deregister the MBean for this * <code>ContextResource</code> object. * * @param resource The ContextResource to be managed * * @exception Exception if an MBean cannot be deregistered */ public static void destroyMBean(ContextResource resource) throws Exception { // If this is a user database resource need to destroy groups, roles, // users and UserDatabase mbean if ("org.apache.catalina.UserDatabase".equals(resource.getType())) { destroyMBeanUserDatabase(resource.getName()); } String mname = createManagedName(resource); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, resource); if( mserver.isRegistered(oname )) mserver.unregisterMBean(oname); }
/** * Set the specified resources in the naming context. */ public void addResource(ContextResource resource) { // Create a reference to the resource. Reference ref = new ResourceRef (resource.getType(), resource.getDescription(), resource.getScope(), resource.getAuth()); // Adding the additional parameters, if any addAdditionalParameters(resource.getNamingResources(), ref, resource.getName()); try { if (debug >= 2) { log(" Adding resource ref " + resource.getName()); log(" " + ref); } createSubcontexts(envCtx, resource.getName()); envCtx.bind(resource.getName(), ref); } catch (NamingException e) { String msg = MessageFormat.format(rb.getString(LogFacade.BIND_OBJECT_FAILED), e); log(msg); } }