org.apache.catalina.deploy.ContextResource的实例源码

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

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

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

    String mname = createManagedname(resource);
    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(resource);
    ObjectName oname = createObjectName(domain,resource);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean,oname);
    return (mbean);

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

}
项目:tomcat7    文件TestNamingContext.java   
@Test
public void testListBindings() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    tomcat.enableNaming();

    // No file system docBase required
    StandardContext ctx = (StandardContext) tomcat.addContext("",null);

    // Create the resource
    ContextResource cr = new ContextResource();
    cr.setName("list/foo");
    cr.setType("org.apache.naming.resources.TesterObject");
    cr.setProperty("factory","org.apache.naming.resources.TesterFactory");
    ctx.getNamingResources().addResource(cr);

    // Map the test Servlet
    Bug23950Servlet bug23950Servlet = new Bug23950Servlet();
    Tomcat.addServlet(ctx,"bug23950Servlet",bug23950Servlet);
    ctx.addServletMapping("/","bug23950Servlet");

    tomcat.start();

    ByteChunk bc = getUrl("http://localhost:" + getPort() + "/");
    assertEquals("org.apache.naming.resources.TesterObject",bc.toString());
}
项目:tomcat7    文件TestNamingContext.java   
@Test
public void testbeanfactory() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    tomcat.enableNaming();

    // No file system docBase required
    StandardContext ctx = (StandardContext) tomcat.addContext("",null);

    // Create the resource
    ContextResource cr = new ContextResource();
    cr.setName("bug50351");
    cr.setType("org.apache.naming.resources.TesterObject");
    cr.setProperty("factory","org.apache.naming.factory.beanfactory");
    cr.setProperty("foo","value");
    ctx.getNamingResources().addResource(cr);

    // Map the test Servlet
    Bug50351Servlet bug50351Servlet = new Bug50351Servlet();
    Tomcat.addServlet(ctx,"bug50351Servlet",bug50351Servlet);
    ctx.addServletMapping("/","bug50351Servlet");

    tomcat.start();

    ByteChunk bc = getUrl("http://localhost:" + getPort() + "/");
    assertEquals("value",bc.toString());
}
项目:lams    文件NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource references for this
 * application.
 */
public String[] getResources() {

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

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

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

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

    String mname = createManagedname(resource);
    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(resource);
    ObjectName oname = createObjectName(domain,oname);
    return (mbean);

}
项目:lams    文件MBeanUtils.java   
/**
 * 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 {

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

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

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

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

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

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

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

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

    String mname = createManagedname(resource);
    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(resource);
    ObjectName oname = createObjectName(domain,resource);
    mserver.registerMBean(mbean,oname);
    return (mbean);

}
项目:jerrydog    文件MBeanUtils.java   
/**
 * 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 {

    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);
    mserver.unregisterMBean(oname);

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

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

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

}
项目:apache-tomcat-7.0.73-with-comment    文件MBeanUtils.java   
/**
 * Create,oname);
    return (mbean);

}
项目:apache-tomcat-7.0.73-with-comment    文件MBeanUtils.java   
/**
 * 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,resource);
    if( mserver.isRegistered(oname ))
        mserver.unregisterMBean(oname);

}
项目:apache-tomcat-7.0.73-with-comment    文件TestNamingContext.java   
@Test
public void testListBindings() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    tomcat.enableNaming();

    // No file system docBase required
    StandardContext ctx = (StandardContext) tomcat.addContext("",bc.toString());
}
项目:apache-tomcat-7.0.73-with-comment    文件TestNamingContext.java   
@Test
public void testbeanfactory() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    tomcat.enableNaming();

    // No file system docBase required
    StandardContext ctx = (StandardContext) tomcat.addContext("",bc.toString());
}
项目:lazycat    文件NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource references for this
 * application.
 */
public String[] getResources() {

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

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

    String mname = createManagedname(resource);
    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(resource);
    ObjectName oname = createObjectName(domain,resource);
    if (mserver.isRegistered(oname)) {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean,oname);
    return (mbean);

}
项目:lazycat    文件MBeanUtils.java   
/**
 * 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,resource);
    if (mserver.isRegistered(oname))
        mserver.unregisterMBean(oname);

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

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

}
项目:class-guard    文件MBeanUtils.java   
/**
 * Create,oname);
    return (mbean);

}
项目:class-guard    文件MBeanUtils.java   
/**
 * 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,resource);
    if( mserver.isRegistered(oname ))
        mserver.unregisterMBean(oname);

}
项目:class-guard    文件TestNamingContext.java   
@Test
public void testListBindings() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    tomcat.enableNaming();

    // Must have a real docBase - just use temp
    StandardContext ctx = (StandardContext)
        tomcat.addContext("",System.getProperty("java.io.tmpdir"));

    // Create the resource
    ContextResource cr = new ContextResource();
    cr.setName("list/foo");
    cr.setType("org.apache.naming.resources.TesterObject");
    cr.setProperty("factory",bc.toString());
}
项目:psi-probe-plus    文件Tomcat55ContainerAdaptor.java   
public void addContextResource(Context context,List resourceList,boolean contextBound) {
    NamingResources namingResources = context.getNamingResources();
    ContextResource[] resources = namingResources.findResources();

    for (int i = 0; i < resources.length; i++) {
        ContextResource contextResource = resources[i];
        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());

        //lookupResource(resource,contextBound,false);

        resourceList.add(resource);
    }
}
项目:psi-probe-plus    文件Tomcat60ContainerAdaptor.java   
public void addContextResource(Context context,false);

        resourceList.add(resource);
    }
}
项目:psi-probe-plus    文件Tomcat50ContainerAdaptor.java   
public void addContextResource(Context context,false);

        resourceList.add(resource);
    }
}
项目:psi-probe-plus    文件Tomcat70ContainerAdaptor.java   
public void addContextResource(Context context,false);

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

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

}
项目:apache-tomcat-7.0.57    文件MBeanUtils.java   
/**
 * Create,oname);
    return (mbean);

}
项目:apache-tomcat-7.0.57    文件MBeanUtils.java   
/**
 * 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,resource);
    if( mserver.isRegistered(oname ))
        mserver.unregisterMBean(oname);

}
项目:apache-tomcat-7.0.57    文件TestNamingContext.java   
@Test
public void testListBindings() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    tomcat.enableNaming();

    // Must have a real docBase - just use temp
    StandardContext ctx = (StandardContext)
        tomcat.addContext("",bc.toString());
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...