当前位置: 首页>>代码示例>>Java>>正文


Java ObjectName.getDomain方法代码示例

本文整理汇总了Java中javax.management.ObjectName.getDomain方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectName.getDomain方法的具体用法?Java ObjectName.getDomain怎么用?Java ObjectName.getDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.management.ObjectName的用法示例。


在下文中一共展示了ObjectName.getDomain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeFolders

import javax.management.ObjectName; //导入方法依赖的package包/类
@Override
protected Folder[] computeFolders(DynamicProxy object) throws IntrospectionException {
    try {
        ObjectName objName = object.getObjectName();
     
        ObjectName pattern = new ObjectName(objName.getDomain() + 
                ":type=" + objName.getKeyProperty("type") + "." + objName.getKeyProperty("name") +
                ",name=*");
        Set<ObjectName> names = object.getMBeanServerConnection().queryNames(pattern, null);
        List<Folder> subfolders = new ArrayList<Folder>();
        for (ObjectName n : names) {
            subfolders.add(new DynamicMBeanToFolderAdapter(
                    new DynamicProxy(
                    n,
                    object.getMBeanServerConnection())));
        }
        return subfolders.toArray(new Folder[0]);
    } catch (Exception ex) {
        throw new IntrospectionException(ex);
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:22,代码来源:DynamicMBeanToFolderAdapter.java

示例2: start

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Process a "start" event for this Host.
 */
public void start() {

	if (log.isDebugEnabled())
		log.debug(sm.getString("hostConfig.start"));

	try {
		ObjectName hostON = host.getObjectName();
		oname = new ObjectName(hostON.getDomain() + ":type=Deployer,host=" + host.getName());
		Registry.getRegistry(null, null).registerComponent(this, oname, this.getClass().getName());
	} catch (Exception e) {
		log.error(sm.getString("hostConfig.jmx.register", oname), e);
	}

	if (!appBase().isDirectory()) {
		log.error(sm.getString("hostConfig.appBase", host.getName(), appBase().getPath()));
		host.setDeployOnStartup(false);
		host.setAutoDeploy(false);
	}

	if (host.getDeployOnStartup())
		deployApps();

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:27,代码来源:HostConfig.java

示例3: start

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Process a "start" event for this Host.
 */
public void start() {

    if (log.isDebugEnabled())
        log.debug(sm.getString("hostConfig.start"));

    try {
        ObjectName hostON = host.getObjectName();
        oname = new ObjectName
            (hostON.getDomain() + ":type=Deployer,host=" + host.getName());
        Registry.getRegistry(null, null).registerComponent
            (this, oname, this.getClass().getName());
    } catch (Exception e) {
        log.error(sm.getString("hostConfig.jmx.register", oname), e);
    }

    if (!appBase().isDirectory()) {
        log.error(sm.getString(
                "hostConfig.appBase", host.getName(), appBase().getPath()));
        host.setDeployOnStartup(false);
        host.setAutoDeploy(false);
    }

    if (host.getDeployOnStartup())
        deployApps();

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:30,代码来源:HostConfig.java

示例4: preRegister

import javax.management.ObjectName; //导入方法依赖的package包/类
public ObjectName preRegister(MBeanServer server,
                              ObjectName name) throws Exception {
    oname=name;
    mserver=server;
    domain=name.getDomain();
    return name;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:Http11Protocol.java

示例5: preRegister

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Allows the object to be registered with an alternative
 * {@link MBeanServer} and/or {@link ObjectName}.
 */
@Override
public final ObjectName preRegister(MBeanServer server, ObjectName name)
        throws Exception {
    
    this.mserver = server;
    this.oname = name;
    this.domain = name.getDomain();

    return oname;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:15,代码来源:LifecycleMBeanBase.java

示例6: createObjectName

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Creates the ObjectName for the ConnectionPoolMBean object to be registered
 * @param original the ObjectName for the DataSource
 * @return the ObjectName for the ConnectionPoolMBean
 * @throws MalformedObjectNameException
 */
public ObjectName createObjectName(ObjectName original) throws MalformedObjectNameException {
    String domain = ConnectionPool.POOL_JMX_DOMAIN;
    Hashtable<String,String> properties = original.getKeyPropertyList();
    String origDomain = original.getDomain();
    properties.put("type", "ConnectionPool");
    properties.put("class", this.getClass().getName());
    if (original.getKeyProperty("path")!=null || properties.get("context")!=null) {
        //this ensures that if the registration came from tomcat, we're not losing
        //the unique domain, but putting that into as an engine attribute
        properties.put("engine", origDomain);
    }
    ObjectName name = new ObjectName(domain,properties);
    return name;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:21,代码来源:DataSource.java

示例7: preRegister

import javax.management.ObjectName; //导入方法依赖的package包/类
@Override
public ObjectName preRegister(MBeanServer server, ObjectName name)
        throws Exception {
    oname = name;
    mserver = server;
    domain = name.getDomain();
    return name;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:9,代码来源:AbstractProtocol.java

示例8: preRegister

import javax.management.ObjectName; //导入方法依赖的package包/类
public ObjectName preRegister(MBeanServer server,
                              ObjectName name) throws Exception {
    oname=name;
    mserver=server;
    domain=name.getDomain();


    return name;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:ValveBase.java

示例9: preRegister

import javax.management.ObjectName; //导入方法依赖的package包/类
public ObjectName preRegister(MBeanServer server,
                              ObjectName name) throws Exception {
    oname=name;
    mserver=server;
    domain=name.getDomain();

    type=name.getKeyProperty("type");
    host=name.getKeyProperty("host");
    path=name.getKeyProperty("path");

    return name;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:RealmBase.java

示例10: createStandardContext

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Create a new StandardContext.
 *
 * @param parent MBean Name of the associated parent component
 * @param path The context path for this Context
 * @param docBase Document base directory (or WAR) for this Context
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createStandardContext(String parent, 
                                    String path,
                                    String docBase,
                                    boolean xmlValidation,
                                    boolean xmlNamespaceAware,
                                    boolean tldValidation,
                                    boolean tldNamespaceAware)
    throws Exception {

    // Create a new StandardContext instance
    StandardContext context = new StandardContext();
    path = getPathStr(path);
    context.setPath(path);
    context.setDocBase(docBase);
    context.setXmlValidation(xmlValidation);
    context.setXmlNamespaceAware(xmlNamespaceAware);
    context.setTldValidation(tldValidation);
    context.setTldNamespaceAware(tldNamespaceAware);
    
    ContextConfig contextConfig = new ContextConfig();
    context.addLifecycleListener(contextConfig);

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    ObjectName deployer = new ObjectName(pname.getDomain()+
                                         ":type=Deployer,host="+
                                         pname.getKeyProperty("host"));
    if(mserver.isRegistered(deployer)) {
        String contextName = context.getName();
        mserver.invoke(deployer, "addServiced",
                       new Object [] {contextName},
                       new String [] {"java.lang.String"});
        String configPath = (String)mserver.getAttribute(deployer,
                                                         "configBaseName");
        String baseName = context.getBaseName();
        File configFile = new File(new File(configPath), baseName+".xml");
        if (configFile.isFile()) {
            context.setConfigFile(configFile.toURI().toURL());
        }
        mserver.invoke(deployer, "manageApp",
                       new Object[] {context},
                       new String[] {"org.apache.catalina.Context"});
        mserver.invoke(deployer, "removeServiced",
                       new Object [] {contextName},
                       new String [] {"java.lang.String"});
    } else {
        log.warn("Deployer not found for "+pname.getKeyProperty("host"));
        Service service = getService(pname);
        Engine engine = (Engine) service.getContainer();
        Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
        host.addChild(context);
    }

    // Return the corresponding MBean name
    return context.getObjectName().toString();

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:67,代码来源:MBeanFactory.java

示例11: createStandardContext

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Create a new StandardContext.
 *
 * @param parent
 *            MBean Name of the associated parent component
 * @param path
 *            The context path for this Context
 * @param docBase
 *            Document base directory (or WAR) for this Context
 *
 * @exception Exception
 *                if an MBean cannot be created or registered
 */
public String createStandardContext(String parent, String path, String docBase, boolean xmlValidation,
		boolean xmlNamespaceAware, boolean tldValidation, boolean tldNamespaceAware) throws Exception {

	Where.amI();
	// Create a new StandardContext instance
	StandardContext context = new StandardContext();

	path = getPathStr(path);
	context.setPath(path);

	context.setDocBase(docBase);
	context.setXmlValidation(xmlValidation);
	context.setXmlNamespaceAware(xmlNamespaceAware);
	context.setTldValidation(tldValidation);
	context.setTldNamespaceAware(tldNamespaceAware);

	ContextConfig contextConfig = new ContextConfig();
	context.addLifecycleListener(contextConfig);

	// Add the new instance to its parent component
	ObjectName pname = new ObjectName(parent);
	ObjectName deployer = new ObjectName(pname.getDomain() + ":type=Deployer,host=" + pname.getKeyProperty("host"));
	if (mserver.isRegistered(deployer)) {
		String contextName = context.getName();
		mserver.invoke(deployer, "addServiced", new Object[] { contextName }, new String[] { "java.lang.String" });
		String configPath = (String) mserver.getAttribute(deployer, "configBaseName");
		String baseName = context.getBaseName();
		File configFile = new File(new File(configPath), baseName + ".xml");
		if (configFile.isFile()) {
			context.setConfigFile(configFile.toURI().toURL());
		}
		mserver.invoke(deployer, "manageApp", new Object[] { context },
				new String[] { "org.apache.catalina.Context" });
		mserver.invoke(deployer, "removeServiced", new Object[] { contextName },
				new String[] { "java.lang.String" });
	} else {
		log.warn("Deployer not found for " + pname.getKeyProperty("host"));
		Service service = getService(pname);
		Engine engine = (Engine) service.getContainer();
		Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
		host.addChild(context);
	}

	// Return the corresponding MBean name
	return context.getObjectName().toString();

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:61,代码来源:MBeanFactory.java

示例12: addNotificationListener

import javax.management.ObjectName; //导入方法依赖的package包/类
public Integer addNotificationListener(final ObjectName name,
    final NotificationFilter filter)
    throws InstanceNotFoundException, IOException {

    if (logger.traceOn()) {
        logger.trace("addNotificationListener",
            "Add a listener at " + name);
    }

    checkState();

    // Explicitly check MBeanPermission for addNotificationListener
    //
    checkMBeanPermission(name, "addNotificationListener");
    if (notificationAccessController != null) {
        notificationAccessController.addNotificationListener(
            connectionId, name, getSubject());
    }
    try {
        boolean instanceOf =
        AccessController.doPrivileged(
                new PrivilegedExceptionAction<Boolean>() {
                    public Boolean run() throws InstanceNotFoundException {
                        return mbeanServer.isInstanceOf(name, broadcasterClass);
                    }
        });
        if (!instanceOf) {
            throw new IllegalArgumentException("The specified MBean [" +
                name + "] is not a " +
                "NotificationBroadcaster " +
                "object.");
        }
    } catch (PrivilegedActionException e) {
        throw (InstanceNotFoundException) extractException(e);
    }

    final Integer id = getListenerID();

    // 6238731: set the default domain if no domain is set.
    ObjectName nn = name;
    if (name.getDomain() == null || name.getDomain().equals("")) {
        try {
            nn = ObjectName.getInstance(mbeanServer.getDefaultDomain(),
                                        name.getKeyPropertyList());
        } catch (MalformedObjectNameException mfoe) {
            // impossible, but...
            IOException ioe = new IOException(mfoe.getMessage());
            ioe.initCause(mfoe);
            throw ioe;
        }
    }

    synchronized (listenerMap) {
        IdAndFilter idaf = new IdAndFilter(id, filter);
        Set<IdAndFilter> set = listenerMap.get(nn);
        // Tread carefully because if set.size() == 1 it may be the
        // Collections.singleton we make here, which is unmodifiable.
        if (set == null)
            set = Collections.singleton(idaf);
        else {
            if (set.size() == 1)
                set = new HashSet<IdAndFilter>(set);
            set.add(idaf);
        }
        listenerMap.put(nn, set);
    }

    return id;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:70,代码来源:ServerNotifForwarder.java

示例13: removeContext

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Remove an existing Context.
 *
 * @param contextName MBean Name of the component to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeContext(String contextName) throws Exception {

    // Acquire a reference to the component to be removed
    ObjectName oname = new ObjectName(contextName);
    String domain = oname.getDomain();
    StandardService service = (StandardService) getService(oname);

    Engine engine = (Engine) service.getContainer();
    String name = oname.getKeyProperty("name");
    name = name.substring(2);
    int i = name.indexOf('/');
    String hostName = name.substring(0,i);
    String path = name.substring(i);
    ObjectName deployer = new ObjectName(domain+":type=Deployer,host="+
                                         hostName);
    String pathStr = getPathStr(path);
    if(mserver.isRegistered(deployer)) {
        mserver.invoke(deployer,"addServiced",
                       new Object[]{pathStr},
                       new String[] {"java.lang.String"});
        mserver.invoke(deployer,"unmanageApp",
                       new Object[] {pathStr},
                       new String[] {"java.lang.String"});
        mserver.invoke(deployer,"removeServiced",
                       new Object[] {pathStr},
                       new String[] {"java.lang.String"});
    } else {
        log.warn("Deployer not found for "+hostName);
        Host host = (Host) engine.findChild(hostName);
        Context context = (Context) host.findChild(pathStr);
        // Remove this component from its parent component
        host.removeChild(context);
        if(context instanceof StandardContext)
        try {
            ((StandardContext)context).destroy();
        } catch (Exception e) {
            log.warn("Error during context [" + context.getName() + "] destroy ", e);
       }
   
    }

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:50,代码来源:MBeanFactory.java

示例14: registerContext

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Register context.
 */
private void registerContext(ObjectName objectName)
    throws Exception {

    String name = objectName.getKeyProperty("name");
    
    // If the domain is the same with ours or the engine 
    // name attribute is the same... - then it's ours
    String targetDomain=objectName.getDomain();
    if( ! domain.equals( targetDomain )) {
        try {
            targetDomain = (String) mBeanServer.getAttribute
                (objectName, "engineName");
        } catch (Exception e) {
            // Ignore
        }
        if( ! domain.equals( targetDomain )) {
            // not ours
            return;
        }
    }

    String hostName = null;
    String contextName = null;
    if (name.startsWith("//")) {
        name = name.substring(2);
    }
    int slash = name.indexOf("/");
    if (slash != -1) {
        hostName = name.substring(0, slash);
        contextName = name.substring(slash);
    } else {
        return;
    }
    // Special case for the root context
    if (contextName.equals("/")) {
        contextName = "";
    }

    if(log.isDebugEnabled())
         log.debug(sm.getString
              ("mapperListener.registerContext", contextName));

    Object context = 
        mBeanServer.invoke(objectName, "findMappingObject", null, null);
        //mBeanServer.getAttribute(objectName, "mappingObject");
    javax.naming.Context resources = (javax.naming.Context)
        mBeanServer.invoke(objectName, "findStaticResources", null, null);
        //mBeanServer.getAttribute(objectName, "staticResources");
    String[] welcomeFiles = (String[])
        mBeanServer.getAttribute(objectName, "welcomeFiles");

    mapper.addContext(hostName, contextName, context, 
                      welcomeFiles, resources);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:59,代码来源:MapperListener.java

示例15: unregisterContext

import javax.management.ObjectName; //导入方法依赖的package包/类
/**
 * Unregister context.
 */
private void unregisterContext(ObjectName objectName)
    throws Exception {

    String name = objectName.getKeyProperty("name");

    // If the domain is the same with ours or the engine 
    // name attribute is the same... - then it's ours
    String targetDomain=objectName.getDomain();
    if( ! domain.equals( targetDomain )) {
        try {
            targetDomain = (String) mBeanServer.getAttribute
                (objectName, "engineName");
        } catch (Exception e) {
            // Ignore
        }
        if( ! domain.equals( targetDomain )) {
            // not ours
            return;
        }
    }

    String hostName = null;
    String contextName = null;
    if (name.startsWith("//")) {
        name = name.substring(2);
    }
    int slash = name.indexOf("/");
    if (slash != -1) {
        hostName = name.substring(0, slash);
        contextName = name.substring(slash);
    } else {
        return;
    }
    // Special case for the root context
    if (contextName.equals("/")) {
        contextName = "";
    }
    // Don't un-map a context that is paused
    MessageBytes hostMB = MessageBytes.newInstance();
    hostMB.setString(hostName);
    MessageBytes contextMB = MessageBytes.newInstance();
    contextMB.setString(contextName);
    MappingData mappingData = new MappingData();
    mapper.map(hostMB, contextMB, mappingData);
    if (mappingData.context instanceof StandardContext &&
            ((StandardContext)mappingData.context).getPaused()) {
        return;
    } 
    if(log.isDebugEnabled())
        log.debug(sm.getString
              ("mapperListener.unregisterContext", contextName));

    mapper.removeContext(hostName, contextName);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:59,代码来源:MapperListener.java


注:本文中的javax.management.ObjectName.getDomain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。