项目: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
项目: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());
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。