當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectName.toString方法代碼示例

本文整理匯總了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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:28,代碼來源:DefaultMBeanServerInterceptor.java

示例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());
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:42,代碼來源:MBeanFactory.java

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

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:32,代碼來源:MBeanFactory.java

示例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;
	}

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:26,代碼來源:MemoryUserDatabaseMBean.java

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

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:27,代碼來源:MBeanFactory.java

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

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:27,代碼來源:MBeanFactory.java

示例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;
	}

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:26,代碼來源:MemoryUserDatabaseMBean.java

示例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;
    }   

}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:34,代碼來源:MBeanFactory.java

示例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;
	}

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:35,代碼來源:MBeanFactory.java

示例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;
    }   


}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:30,代碼來源:MBeanFactory.java

示例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();
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:8,代碼來源:ManagementAdapter.java

示例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;
    }   

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:35,代碼來源:MBeanFactory.java

示例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());
    
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:MBeanFactory.java

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

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:MBeanFactory.java

示例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;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:OldMBeanServerTest.java


注:本文中的javax.management.ObjectName.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。