List of usage examples for javax.management ObjectName toString
@Override
public String toString()
Returns a string representation of the object name.
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new StandardService./*from ww w.j a v a 2 s. c om*/ * * @param parent MBean Name of the associated parent component * @param name Unique name of this StandardService * * @exception Exception if an MBean cannot be created or registered */ public String createStandardService(String parent, String name) throws Exception { // Create a new StandardService instance StandardService service = new StandardService(); service.setName(name); // Add the new instance to its parent component Server server = ServerFactory.getServer(); server.addService(service); // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("StandardService"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), service); return (oname.toString()); }
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new StandardEngine./*from w w w . j ava 2s . co m*/ * * @param parent MBean Name of the associated parent component * @param name Unique name of this Engine * @param defaultHost Default hostname of this Engine * * @exception Exception if an MBean cannot be created or registered */ public String createStandardEngine(String parent, String name, String defaultHost) throws Exception { // Create a new StandardEngine instance StandardEngine engine = new StandardEngine(); engine.setName(name); engine.setDefaultHost(defaultHost); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); Server server = ServerFactory.getServer(); Service service = server.findService(pname.getKeyProperty("name")); service.setContainer(engine); // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("StandardEngine"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), engine); return (oname.toString()); }
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new StandardHost./*from w w w. j a v a 2 s. c o m*/ * * @param parent MBean Name of the associated parent component * @param name Unique name of this Host * @param appBase Application base directory name * @param autoDeploy Should we auto deploy? * @param deployXML Should we deploy Context XML config files property? * @param liveDeploy Should we live deploy? * @param unpackWARs Should we unpack WARs when auto deploying? * * @exception Exception if an MBean cannot be created or registered */ public String createStandardHost(String parent, String name, String appBase, boolean autoDeploy, boolean deployXML, boolean liveDeploy, boolean unpackWARs) throws Exception { // Create a new StandardHost instance StandardHost host = new StandardHost(); host.setName(name); host.setAppBase(appBase); host.setAutoDeploy(autoDeploy); host.setDeployXML(deployXML); host.setLiveDeploy(liveDeploy); host.setUnpackWARs(unpackWARs); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); Server server = ServerFactory.getServer(); Service service = server.findService(pname.getKeyProperty("service")); Engine engine = (Engine) service.getContainer(); engine.addChild(host); // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("StandardHost"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), host); return (oname.toString()); }
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new JDBC Realm.//from w ww. j a v a2s .c o m * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createJDBCRealm(String parent) throws Exception { // Create a new JDBCRealm instance JDBCRealm realm = new JDBCRealm(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); String type = pname.getKeyProperty("type"); Server server = ServerFactory.getServer(); Service service = server.findService(pname.getKeyProperty("service")); Engine engine = (Engine) service.getContainer(); if (type.equals("Context")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); String pathStr = getPathStr(pname.getKeyProperty("path")); Context context = (Context) host.findChild(pathStr); context.setRealm(realm); } else if (type.equals("Engine")) { engine.setRealm(realm); } else if (type.equals("Host")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); host.setRealm(realm); } // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("JDBCRealm"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), realm); return (oname.toString()); }
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new JNDI Realm.//from ww w . java 2 s . c o m * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createJNDIRealm(String parent) throws Exception { // Create a new JNDIRealm instance JNDIRealm realm = new JNDIRealm(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); String type = pname.getKeyProperty("type"); Server server = ServerFactory.getServer(); Service service = server.findService(pname.getKeyProperty("service")); Engine engine = (Engine) service.getContainer(); if (type.equals("Context")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); String pathStr = getPathStr(pname.getKeyProperty("path")); Context context = (Context) host.findChild(pathStr); context.setRealm(realm); } else if (type.equals("Engine")) { engine.setRealm(realm); } else if (type.equals("Host")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); host.setRealm(realm); } // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("JNDIRealm"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), realm); return (oname.toString()); }
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new Memory Realm.// ww w . j a va2 s . c o m * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createMemoryRealm(String parent) throws Exception { // Create a new MemoryRealm instance MemoryRealm realm = new MemoryRealm(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); String type = pname.getKeyProperty("type"); Server server = ServerFactory.getServer(); Service service = server.findService(pname.getKeyProperty("service")); Engine engine = (Engine) service.getContainer(); if (type.equals("Context")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); String pathStr = getPathStr(pname.getKeyProperty("path")); Context context = (Context) host.findChild(pathStr); context.setRealm(realm); } else if (type.equals("Engine")) { engine.setRealm(realm); } else if (type.equals("Host")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); host.setRealm(realm); } // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("MemoryRealm"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), realm); return (oname.toString()); }
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new Remote Address Filter Valve. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered *///from ww w . j av a 2 s .c o m public String createRemoteAddrValve(String parent) throws Exception { // Create a new RemoteAddrValve instance RemoteAddrValve valve = new RemoteAddrValve(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); String type = pname.getKeyProperty("type"); Server server = ServerFactory.getServer(); Service service = server.findService(pname.getKeyProperty("service")); Engine engine = (Engine) service.getContainer(); if (type.equals("Context")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); String pathStr = getPathStr(pname.getKeyProperty("path")); Context context = (Context) host.findChild(pathStr); ((StandardContext) context).addValve(valve); } else if (type.equals("Engine")) { ((StandardEngine) engine).addValve(valve); } else if (type.equals("Host")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); ((StandardHost) host).addValve(valve); } // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("RemoteAddrValve"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), valve); return (oname.toString()); }
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new Remote Host Filter Valve. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */// w ww.j a v a 2s .co m public String createRemoteHostValve(String parent) throws Exception { // Create a new RemoteHostValve instance RemoteHostValve valve = new RemoteHostValve(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); String type = pname.getKeyProperty("type"); Server server = ServerFactory.getServer(); Service service = server.findService(pname.getKeyProperty("service")); Engine engine = (Engine) service.getContainer(); if (type.equals("Context")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); String pathStr = getPathStr(pname.getKeyProperty("path")); Context context = (Context) host.findChild(pathStr); ((StandardContext) context).addValve(valve); } else if (type.equals("Engine")) { ((StandardEngine) engine).addValve(valve); } else if (type.equals("Host")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); ((StandardHost) host).addValve(valve); } // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("RemoteHostValve"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), valve); return (oname.toString()); }
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new Request Dumper Valve./*from w w w .j a va 2s. c om*/ * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createRequestDumperValve(String parent) throws Exception { // Create a new RequestDumperValve instance RequestDumperValve valve = new RequestDumperValve(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); String type = pname.getKeyProperty("type"); Server server = ServerFactory.getServer(); Service service = server.findService(pname.getKeyProperty("service")); Engine engine = (Engine) service.getContainer(); if (type.equals("Context")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); String pathStr = getPathStr(pname.getKeyProperty("path")); Context context = (Context) host.findChild(pathStr); ((StandardContext) context).addValve(valve); } else if (type.equals("Engine")) { ((StandardEngine) engine).addValve(valve); } else if (type.equals("Host")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); ((StandardHost) host).addValve(valve); } // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("RequestDumperValve"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), valve); return (oname.toString()); }
From source file:catalina.mbeans.MBeanFactory.java
/** * Create a new Single Sign On Valve./* w w w .java 2 s . c om*/ * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createSingleSignOn(String parent) throws Exception { // Create a new SingleSignOn instance SingleSignOn valve = new SingleSignOn(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); String type = pname.getKeyProperty("type"); Server server = ServerFactory.getServer(); Service service = server.findService(pname.getKeyProperty("service")); Engine engine = (Engine) service.getContainer(); if (type.equals("Context")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); String pathStr = getPathStr(pname.getKeyProperty("path")); Context context = (Context) host.findChild(pathStr); ((StandardContext) context).addValve(valve); } else if (type.equals("Engine")) { ((StandardEngine) engine).addValve(valve); } else if (type.equals("Host")) { Host host = (Host) engine.findChild(pname.getKeyProperty("host")); ((StandardHost) host).addValve(valve); } // Return the corresponding MBean name ManagedBean managed = registry.findManagedBean("SingleSignOn"); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), valve); return (oname.toString()); }