本文整理汇总了Java中javax.management.ObjectName.toString方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectName.toString方法的具体用法?Java ObjectName.toString怎么用?Java ObjectName.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.ObjectName
的用法示例。
在下文中一共展示了ObjectName.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClassLoader
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* <p>Return the named {@link java.lang.ClassLoader}.
* @param loaderName The ObjectName of the ClassLoader.
* @return The named ClassLoader.
* @exception InstanceNotFoundException if the named ClassLoader
* is not found.
*/
public ClassLoader getClassLoader(ObjectName loaderName)
throws InstanceNotFoundException {
if (loaderName == null) {
checkMBeanPermission((String) null, null, null, "getClassLoader");
return server.getClass().getClassLoader();
}
DynamicMBean instance = getMBean(loaderName);
checkMBeanPermission(instance, null, loaderName, "getClassLoader");
Object resource = getResource(instance);
/* Check if the given MBean is a ClassLoader */
if (!(resource instanceof ClassLoader))
throw new InstanceNotFoundException(loaderName.toString() +
" is not a classloader");
return (ClassLoader) resource;
}
示例2: createConnector
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create a new Connector
*
* @param parent
* MBean Name of the associated parent component
* @param address
* The IP address on which to bind
* @param port
* TCP port number to listen on
* @param isAjp
* Create a AJP/1.3 Connector
* @param isSSL
* Create a secure Connector
*
* @exception Exception
* if an MBean cannot be created or registered
*/
private String createConnector(String parent, String address, int port, boolean isAjp, boolean isSSL)
throws Exception {
Connector retobj = new Connector();
if ((address != null) && (address.length() > 0)) {
retobj.setProperty("address", address);
}
// Set port number
retobj.setPort(port);
// Set the protocol
retobj.setProtocol(isAjp ? "AJP/1.3" : "HTTP/1.1");
// Set SSL
retobj.setSecure(isSSL);
retobj.setScheme(isSSL ? "https" : "http");
// Add the new instance to its parent component
// FIX ME - addConnector will fail
ObjectName pname = new ObjectName(parent);
Service service = getService(pname);
service.addConnector(retobj);
// Return the corresponding MBean name
ObjectName coname = retobj.getObjectName();
return (coname.toString());
}
示例3: createStandardEngine
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create a new StandardEngine.
*
* @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());
}
示例4: findUser
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Return the MBean Name for the specified user name (if any); otherwise
* return <code>null</code>.
*
* @param username
* User name to look up
*/
public String findUser(String username) {
UserDatabase database = (UserDatabase) this.resource;
User user = database.findUser(username);
if (user == null) {
return (null);
}
try {
ObjectName oname = MBeanUtils.createObjectName(managedUser.getDomain(), user);
return (oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException(
"Cannot create object name for user [" + username + "]");
iae.initCause(e);
throw iae;
}
}
示例5: createWebappLoader
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create a new Web Application Loader.
*
* @param parent
* MBean Name of the associated parent component
*
* @exception Exception
* if an MBean cannot be created or registered
*/
public String createWebappLoader(String parent) throws Exception {
// Create a new WebappLoader instance
WebappLoader loader = new WebappLoader();
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
ContainerBase containerBase = getParentContainerFromParent(pname);
if (containerBase != null) {
containerBase.setLoader(loader);
}
// FIXME add Loader.getObjectName
// ObjectName oname = loader.getObjectName();
ObjectName oname = MBeanUtils.createObjectName(pname.getDomain(), loader);
return (oname.toString());
}
示例6: createSingleSignOn
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create a new Single Sign On Valve.
*
* @param parent MBean Name of the associated parent component
*
* @exception Exception if an MBean cannot be created or registered
*
* @deprecated Will be removed in Tomcat 8.0.x. Replaced by {@link
* #createValve(String, String)}.
*/
@Deprecated
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);
ContainerBase containerBase = getParentContainerFromParent(pname);
containerBase.getPipeline().addValve(valve);
ObjectName oname = valve.getObjectName();
return (oname.toString());
}
示例7: findGroup
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Return the MBean Name for the specified group name (if any); otherwise
* return <code>null</code>.
*
* @param groupname
* Group name to look up
*/
public String findGroup(String groupname) {
UserDatabase database = (UserDatabase) this.resource;
Group group = database.findGroup(groupname);
if (group == null) {
return (null);
}
try {
ObjectName oname = MBeanUtils.createObjectName(managedGroup.getDomain(), group);
return (oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException(
"Cannot create object name for group [" + groupname + "]");
iae.initCause(e);
throw iae;
}
}
示例8: createUserDatabaseRealm
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create a new UserDatabaseRealm.
*
* @param parent MBean Name of the associated parent component
* @param resourceName Global JNDI resource name of the associated
* UserDatabase
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createUserDatabaseRealm(String parent, String resourceName)
throws Exception {
// Create a new UserDatabaseRealm instance
UserDatabaseRealm realm = new UserDatabaseRealm();
realm.setResourceName(resourceName);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
ContainerBase containerBase = getParentContainerFromParent(pname);
// Add the new instance to its parent component
containerBase.setRealm(realm);
// Return the corresponding MBean name
ObjectName oname = realm.getObjectName();
// FIXME getObjectName() returns null
//ObjectName oname =
// MBeanUtils.createObjectName(pname.getDomain(), realm);
if (oname != null) {
return (oname.toString());
} else {
return null;
}
}
示例9: createUserDatabaseRealm
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create a new UserDatabaseRealm.
*
* @param parent
* MBean Name of the associated parent component
* @param resourceName
* Global JNDI resource name of the associated UserDatabase
*
* @exception Exception
* if an MBean cannot be created or registered
*/
public String createUserDatabaseRealm(String parent, String resourceName) throws Exception {
// Create a new UserDatabaseRealm instance
UserDatabaseRealm realm = new UserDatabaseRealm();
realm.setResourceName(resourceName);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
ContainerBase containerBase = getParentContainerFromParent(pname);
// Add the new instance to its parent component
containerBase.setRealm(realm);
// Return the corresponding MBean name
ObjectName oname = realm.getObjectName();
// FIXME getObjectName() returns null
// ObjectName oname =
// MBeanUtils.createObjectName(pname.getDomain(), realm);
if (oname != null) {
return (oname.toString());
} else {
return null;
}
}
示例10: createJNDIRealm
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create a new JNDI Realm.
*
* @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);
ContainerBase containerBase = getParentContainerFromParent(pname);
// Add the new instance to its parent component
containerBase.setRealm(realm);
// Return the corresponding MBean name
ObjectName oname = realm.getObjectName();
if (oname != null) {
return (oname.toString());
} else {
return null;
}
}
示例11: CacheServerMembershipListenerAdapter
import javax.management.ObjectName; //导入方法依赖的package包/类
public CacheServerMembershipListenerAdapter(
NotificationBroadcasterSupport serverLevelNotifEmitter,
NotificationBroadcasterSupport memberLevelNotifEmitter, ObjectName serverSource) {
this.serverLevelNotifEmitter = serverLevelNotifEmitter;
this.memberLevelNotifEmitter = memberLevelNotifEmitter;
this.serverSource = serverSource.toString();
}
示例12: createDataSourceRealm
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create a new DataSource Realm.
*
* @param parent MBean Name of the associated parent component
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createDataSourceRealm(String parent, String dataSourceName,
String roleNameCol, String userCredCol, String userNameCol,
String userRoleTable, String userTable) throws Exception {
// Create a new DataSourceRealm instance
DataSourceRealm realm = new DataSourceRealm();
realm.setDataSourceName(dataSourceName);
realm.setRoleNameCol(roleNameCol);
realm.setUserCredCol(userCredCol);
realm.setUserNameCol(userNameCol);
realm.setUserRoleTable(userRoleTable);
realm.setUserTable(userTable);
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
ContainerBase containerBase = getParentContainerFromParent(pname);
// Add the new instance to its parent component
containerBase.setRealm(realm);
// Return the corresponding MBean name
ObjectName oname = realm.getObjectName();
if (oname != null) {
return (oname.toString());
} else {
return null;
}
}
示例13: createRemoteHostValve
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* 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
*/
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);
ContainerBase containerBase = getParentContainerFromParent(pname);
containerBase.addValve(valve);
ObjectName oname = valve.getObjectName();
return (oname.toString());
}
示例14: createRequestDumperValve
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create a new Request Dumper Valve.
*
* @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);
ContainerBase containerBase = getParentContainerFromParent(pname);
containerBase.addValve(valve);
ObjectName oname = valve.getObjectName();
return (oname.toString());
}
示例15: getMBean
import javax.management.ObjectName; //导入方法依赖的package包/类
private DynamicMBean getMBean(ObjectName name)
throws InstanceNotFoundException {
DynamicMBean mbean = mbeans.get(name);
if (mbean == null)
throw new InstanceNotFoundException(name.toString());
return mbean;
}