Java 类org.apache.catalina.deploy.ContextResourceLink 实例源码

项目:tomcat7    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource link references for 
 * this application.
 */
public String[] getResourceLinks() {

    ContextResourceLink[] resourceLinks = 
                        ((NamingResources)this.resource).findResourceLinks();
    ArrayList<String> results = new ArrayList<String>();
    for (int i = 0; i < resourceLinks.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), resourceLinks[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for resource " + resourceLinks[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:tomcat7    文件:NamingResourcesMBean.java   
/**
 * Remove any resource link reference with the specified name.
 *
 * @param resourceLinkName Name of the resource link reference to remove
 */
public void removeResourceLink(String resourceLinkName) {

    resourceLinkName = ObjectName.unquote(resourceLinkName);
    NamingResources nresources = (NamingResources) this.resource;
    if (nresources == null) {
        return;
    }
    ContextResourceLink resourceLink = 
                        nresources.findResourceLink(resourceLinkName);
    if (resourceLink == null) {
        throw new IllegalArgumentException
            ("Invalid resource Link name '" + resourceLinkName + "'");
    }
    nresources.removeResourceLink(resourceLinkName);
}
项目:tomcat7    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static DynamicMBean createMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:tomcat7    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
public static void destroyMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered(oname) )
        mserver.unregisterMBean(oname);

}
项目:lams    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource link references for 
 * this application.
 */
public String[] getResourceLinks() {

    ContextResourceLink[] resourceLinks = 
                        ((NamingResources)this.resource).findResourceLinks();
    ArrayList results = new ArrayList();
    for (int i = 0; i < resourceLinks.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), resourceLinks[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for resource " + resourceLinks[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return ((String[]) results.toArray(new String[results.size()]));

}
项目:lams    文件:NamingResourcesMBean.java   
/**
 * Remove any resource link reference with the specified name.
 *
 * @param resourceLinkName Name of the resource link reference to remove
 */
public void removeResourceLink(String resourceLinkName) {

    resourceLinkName = ObjectName.unquote(resourceLinkName);
    NamingResources nresources = (NamingResources) this.resource;
    if (nresources == null) {
        return;
    }
    ContextResourceLink resourceLink = 
                        nresources.findResourceLink(resourceLinkName);
    if (resourceLink == null) {
        throw new IllegalArgumentException
            ("Invalid resource Link name '" + resourceLinkName + "'");
    }
    nresources.removeResourceLink(resourceLinkName);
}
项目:lams    文件:StandardContextMBean.java   
/**
 * Return the MBean Names of all the defined resource links for this 
 * application
 */
public String[] getResourceLinks() {

    ContextResourceLink[] links = getNamingResources().findResourceLinks();
    ArrayList results = new ArrayList();
    for (int i = 0; i < links.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), links[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for resource " + links[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return ((String[]) results.toArray(new String[results.size()]));

}
项目:lams    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
static DynamicMBean createMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:lams    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
static void destroyMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered(oname) )
        mserver.unregisterMBean(oname);

}
项目:lams    文件:NamingContextListener.java   
/**
 * 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));
    }

}
项目:jerrydog    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource link references for 
 * this application.
 */
public String[] getResourceLinks() {

    ContextResourceLink[] resourceLinks = 
                        ((NamingResources)this.resource).findResourceLinks();
    ArrayList results = new ArrayList();
    for (int i = 0; i < resourceLinks.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), resourceLinks[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            throw new IllegalArgumentException
                ("Cannot create object name for resource " + resourceLinks[i]);
        }
    }
    return ((String[]) results.toArray(new String[results.size()]));

}
项目:jerrydog    文件:NamingResourcesMBean.java   
/**
 * Remove any resource link reference with the specified name.
 *
 * @param resourceLinkName Name of the resource link reference to remove
 */
public void removeResourceLink(String resourceLinkName) {

    resourceLinkName = URLDecoder.decode(resourceLinkName);
    NamingResources nresources = (NamingResources) this.resource;
    if (nresources == null) {
        return;
    }
    ContextResourceLink resourceLink = 
                        nresources.findResourceLink(resourceLinkName);
    if (resourceLink == null) {
        throw new IllegalArgumentException
            ("Invalid resource Link name '" + resourceLinkName + "'");
    }
    nresources.removeResourceLink(resourceLinkName);
}
项目:jerrydog    文件:StandardContextMBean.java   
/**
 * Return the MBean Names of all the defined resource links for this 
 * application
 */
public String[] getResourceLinks() {

    ContextResourceLink[] links = getNamingResources().findResourceLinks();
    ArrayList results = new ArrayList();
    for (int i = 0; i < links.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), links[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            throw new IllegalArgumentException
                ("Cannot create object name for resource " + links[i]);
        }
    }
    return ((String[]) results.toArray(new String[results.size()]));

}
项目:jerrydog    文件:DefaultContextMBean.java   
/**
 * Return the MBean Names of all the defined resource links for this 
 * application
 */
public String[] getResourceLinks() {

    ContextResourceLink[] links = getNamingResources().findResourceLinks();
    ArrayList results = new ArrayList();
    for (int i = 0; i < links.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), links[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            throw new IllegalArgumentException
                ("Cannot create object name for resource " + links[i]);
        }
    }
    return ((String[]) results.toArray(new String[results.size()]));

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ModelMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:jerrydog    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
public static void destroyMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, resourceLink);
    mserver.unregisterMBean(oname);

}
项目:jerrydog    文件:NamingContextListener.java   
/**
 * 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) {
        log(sm.getString("naming.bindFailed", e));
    }

}
项目:apache-tomcat-7.0.73-with-comment    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource link references for 
 * this application.
 */
public String[] getResourceLinks() {

    ContextResourceLink[] resourceLinks = 
                        ((NamingResources)this.resource).findResourceLinks();
    ArrayList<String> results = new ArrayList<String>();
    for (int i = 0; i < resourceLinks.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), resourceLinks[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for resource " + resourceLinks[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:apache-tomcat-7.0.73-with-comment    文件:NamingResourcesMBean.java   
/**
 * Remove any resource link reference with the specified name.
 *
 * @param resourceLinkName Name of the resource link reference to remove
 */
public void removeResourceLink(String resourceLinkName) {

    resourceLinkName = ObjectName.unquote(resourceLinkName);
    NamingResources nresources = (NamingResources) this.resource;
    if (nresources == null) {
        return;
    }
    ContextResourceLink resourceLink = 
                        nresources.findResourceLink(resourceLinkName);
    if (resourceLink == null) {
        throw new IllegalArgumentException
            ("Invalid resource Link name '" + resourceLinkName + "'");
    }
    nresources.removeResourceLink(resourceLinkName);
}
项目:apache-tomcat-7.0.73-with-comment    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static DynamicMBean createMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:apache-tomcat-7.0.73-with-comment    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
public static void destroyMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered(oname) )
        mserver.unregisterMBean(oname);

}
项目:lazycat    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource link references for
 * this application.
 */
public String[] getResourceLinks() {

    ContextResourceLink[] resourceLinks = ((NamingResources) this.resource).findResourceLinks();
    ArrayList<String> results = new ArrayList<String>();
    for (int i = 0; i < resourceLinks.length; i++) {
        try {
            ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), resourceLinks[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException(
                    "Cannot create object name for resource " + resourceLinks[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:lazycat    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink
 *            The ContextResourceLink to be managed
 *
 * @exception Exception
 *                if an MBean cannot be created or registered
 */
public static DynamicMBean createMBean(ContextResourceLink resourceLink) throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with " + mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    if (mserver.isRegistered(oname)) {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:lazycat    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this <code>ContextResourceLink</code> object.
 *
 * @param resourceLink
 *            The ContextResourceLink to be managed
 *
 * @exception Exception
 *                if an MBean cannot be deregistered
 */
public static void destroyMBean(ContextResourceLink resourceLink) throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, resourceLink);
    if (mserver.isRegistered(oname))
        mserver.unregisterMBean(oname);

}
项目:psi-probe    文件:Tomcat70ContainerAdapter.java   
@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);
  }
}
项目:class-guard    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource link references for 
 * this application.
 */
public String[] getResourceLinks() {

    ContextResourceLink[] resourceLinks = 
                        ((NamingResources)this.resource).findResourceLinks();
    ArrayList<String> results = new ArrayList<String>();
    for (int i = 0; i < resourceLinks.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), resourceLinks[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for resource " + resourceLinks[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:class-guard    文件:NamingResourcesMBean.java   
/**
 * Remove any resource link reference with the specified name.
 *
 * @param resourceLinkName Name of the resource link reference to remove
 */
public void removeResourceLink(String resourceLinkName) {

    resourceLinkName = ObjectName.unquote(resourceLinkName);
    NamingResources nresources = (NamingResources) this.resource;
    if (nresources == null) {
        return;
    }
    ContextResourceLink resourceLink = 
                        nresources.findResourceLink(resourceLinkName);
    if (resourceLink == null) {
        throw new IllegalArgumentException
            ("Invalid resource Link name '" + resourceLinkName + "'");
    }
    nresources.removeResourceLink(resourceLinkName);
}
项目:class-guard    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static DynamicMBean createMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:class-guard    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
public static void destroyMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered(oname) )
        mserver.unregisterMBean(oname);

}
项目:psi-probe-plus    文件:Tomcat55ContainerAdaptor.java   
public void addContextResourceLink(Context context, List resourceList,
        boolean contextBound) {
    ContextResourceLink[] resourceLinks = context.getNamingResources().findResourceLinks();
    for (int i = 0; i < resourceLinks.length; i++) {
        ContextResourceLink link = resourceLinks[i];

        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());

       // lookupResource(resource, contextBound, false);

        resourceList.add(resource);
    }
}
项目:psi-probe-plus    文件:Tomcat60ContainerAdaptor.java   
public void addContextResourceLink(Context context, List resourceList,
        boolean contextBound) {
    ContextResourceLink[] resourceLinks = context.getNamingResources().findResourceLinks();
    for (int i = 0; i < resourceLinks.length; i++) {
        ContextResourceLink link = resourceLinks[i];

        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());

       // lookupResource(resource, contextBound, false);

        resourceList.add(resource);
    }
}
项目:psi-probe-plus    文件:Tomcat50ContainerAdaptor.java   
public void addContextResourceLink(Context context, List resourceList,
        boolean contextBound) {
    ContextResourceLink[] resourceLinks = context.getNamingResources().findResourceLinks();
    for (int i = 0; i < resourceLinks.length; i++) {
        ContextResourceLink link = resourceLinks[i];

        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());

        // lookupResource(resource, contextBound, false);

        resourceList.add(resource);
    }
}
项目:psi-probe-plus    文件:Tomcat70ContainerAdaptor.java   
public void addContextResourceLink(Context context, List resourceList,
        boolean contextBound) {
    ContextResourceLink[] resourceLinks = context.getNamingResources().findResourceLinks();
    for (int i = 0; i < resourceLinks.length; i++) {
        ContextResourceLink link = resourceLinks[i];

        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());

        // lookupResource(resource, contextBound, false);

        resourceList.add(resource);
    }
}
项目:apache-tomcat-7.0.57    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource link references for 
 * this application.
 */
public String[] getResourceLinks() {

    ContextResourceLink[] resourceLinks = 
                        ((NamingResources)this.resource).findResourceLinks();
    ArrayList<String> results = new ArrayList<String>();
    for (int i = 0; i < resourceLinks.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), resourceLinks[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for resource " + resourceLinks[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:apache-tomcat-7.0.57    文件:NamingResourcesMBean.java   
/**
 * Remove any resource link reference with the specified name.
 *
 * @param resourceLinkName Name of the resource link reference to remove
 */
public void removeResourceLink(String resourceLinkName) {

    resourceLinkName = ObjectName.unquote(resourceLinkName);
    NamingResources nresources = (NamingResources) this.resource;
    if (nresources == null) {
        return;
    }
    ContextResourceLink resourceLink = 
                        nresources.findResourceLink(resourceLinkName);
    if (resourceLink == null) {
        throw new IllegalArgumentException
            ("Invalid resource Link name '" + resourceLinkName + "'");
    }
    nresources.removeResourceLink(resourceLinkName);
}
项目:apache-tomcat-7.0.57    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static DynamicMBean createMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
项目:apache-tomcat-7.0.57    文件:MBeanUtils.java   
/**
 * Deregister the MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
public static void destroyMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered(oname) )
        mserver.unregisterMBean(oname);

}
项目:apache-tomcat-7.0.57    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource link references for 
 * this application.
 */
public String[] getResourceLinks() {

    ContextResourceLink[] resourceLinks = 
                        ((NamingResources)this.resource).findResourceLinks();
    ArrayList<String> results = new ArrayList<String>();
    for (int i = 0; i < resourceLinks.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), resourceLinks[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for resource " + resourceLinks[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:apache-tomcat-7.0.57    文件:NamingResourcesMBean.java   
/**
 * Remove any resource link reference with the specified name.
 *
 * @param resourceLinkName Name of the resource link reference to remove
 */
public void removeResourceLink(String resourceLinkName) {

    resourceLinkName = ObjectName.unquote(resourceLinkName);
    NamingResources nresources = (NamingResources) this.resource;
    if (nresources == null) {
        return;
    }
    ContextResourceLink resourceLink = 
                        nresources.findResourceLink(resourceLinkName);
    if (resourceLink == null) {
        throw new IllegalArgumentException
            ("Invalid resource Link name '" + resourceLinkName + "'");
    }
    nresources.removeResourceLink(resourceLinkName);
}
项目:apache-tomcat-7.0.57    文件:MBeanUtils.java   
/**
 * Create, register, and return an MBean for this
 * <code>ContextResourceLink</code> object.
 *
 * @param resourceLink The ContextResourceLink to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static DynamicMBean createMBean(ContextResourceLink resourceLink)
    throws Exception {

    String mname = createManagedName(resourceLink);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(resourceLink);
    ObjectName oname = createObjectName(domain, resourceLink);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}