java类javax.management.MalformedObjectNameException的实例源码

StandardContextMBean.java 文件源码 项目:lams 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Return the MBean Names of the set of defined environment entries for  
 * this web application
 */
public String[] getEnvironments() {
    ContextEnvironment[] envs = getNamingResources().findEnvironments();
    ArrayList results = new ArrayList();
    for (int i = 0; i < envs.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for environment " + envs[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return ((String[]) results.toArray(new String[results.size()]));

}
StandardContextMBean.java 文件源码 项目:lams 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Return the MBean Names of all the defined resource links for this 
 * application
 */
public String[] getResourceLinks() {

    ContextResourceLink[] links = getNamingResources().findResourceLinks();
    ArrayList results = new ArrayList();
    for (int i = 0; i < links.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), links[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for resource " + links[i]);
            iae.initCause(e);
            throw iae;
        }
    }
    return ((String[]) results.toArray(new String[results.size()]));

}
MBeanRegistry.java 文件源码 项目:ZooKeeper 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Builds an MBean path and creates an ObjectName instance using the path. 
 * @param path MBean path
 * @param bean the MBean instance
 * @return ObjectName to be registered with the platform MBean server
 */
protected ObjectName makeObjectName(String path, ZKMBeanInfo bean)
    throws MalformedObjectNameException
{
    if(path==null)
        return null;
    StringBuilder beanName = new StringBuilder(CommonNames.DOMAIN + ":");
    int counter=0;
    counter=tokenize(beanName,path,counter);
    tokenize(beanName,bean.getName(),counter);
    beanName.deleteCharAt(beanName.length()-1);
    try {
        return new ObjectName(beanName.toString());
    } catch (MalformedObjectNameException e) {
        LOG.warn("Invalid name \"" + beanName.toString() + "\" for class "
                + bean.getClass().toString());
        throw e;
    }
}
JmxServiceImpl.java 文件源码 项目:lams 阅读 29 收藏 0 点赞 0 评论 0
@Override
public void registerService(Manageable service, Class<? extends Service> serviceRole) {
    final String domain = service.getManagementDomain() == null
            ? AvailableSettings.JMX_DEFAULT_OBJ_NAME_DOMAIN
            : service.getManagementDomain();
    final String serviceType = service.getManagementServiceType() == null
            ? service.getClass().getName()
            : service.getManagementServiceType();
    try {
        final ObjectName objectName = new ObjectName(
                String.format(
                        OBJ_NAME_TEMPLATE,
                        domain,
                        sessionFactoryName,
                        serviceRole.getName(),
                        serviceType
                )
        );
        registerMBean( objectName, service.getManagementBean() );
    }
    catch ( MalformedObjectNameException e ) {
        throw new HibernateException( "Unable to generate service IbjectName", e );
    }
}
MBeanRegistry.java 文件源码 项目:https-github.com-apache-zookeeper 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Builds an MBean path and creates an ObjectName instance using the path. 
 * @param path MBean path
 * @param bean the MBean instance
 * @return ObjectName to be registered with the platform MBean server
 */
protected ObjectName makeObjectName(String path, ZKMBeanInfo bean)
    throws MalformedObjectNameException
{
    if(path==null)
        return null;
    StringBuilder beanName = new StringBuilder(CommonNames.DOMAIN + ":");
    int counter=0;
    counter=tokenize(beanName,path,counter);
    tokenize(beanName,bean.getName(),counter);
    beanName.deleteCharAt(beanName.length()-1);
    try {
        return new ObjectName(beanName.toString());
    } catch (MalformedObjectNameException e) {
        LOG.warn("Invalid name \"" + beanName.toString() + "\" for class "
                + bean.getClass().toString());
        throw e;
    }
}
NamingResourcesMBean.java 文件源码 项目:jerrydog 阅读 14 收藏 0 点赞 0 评论 0
/**
 * Return the MBean Names of the set of defined environment entries for  
 * this web application
 */
public String[] getEnvironments() {
    ContextEnvironment[] envs = 
                        ((NamingResources)this.resource).findEnvironments();
    ArrayList results = new ArrayList();
    for (int i = 0; i < envs.length; i++) {
        try {
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            throw new IllegalArgumentException
                ("Cannot create object name for environment " + envs[i]);
        }
    }
    return ((String[]) results.toArray(new String[results.size()]));

}
QpidJmsPoolTestSupport.java 文件源码 项目:pooled-jms 阅读 19 收藏 0 点赞 0 评论 0
protected BrokerViewMBean getProxyToBroker() throws MalformedObjectNameException, JMSException {
    ObjectName brokerViewMBean = new ObjectName(
        "org.apache.activemq:type=Broker,brokerName=" + brokerService.getBrokerName());
    BrokerViewMBean proxy = (BrokerViewMBean) brokerService.getManagementContext()
            .newProxyInstance(brokerViewMBean, BrokerViewMBean.class, true);
    return proxy;
}
ActiveMQJmsPoolTestSupport.java 文件源码 项目:pooled-jms 阅读 14 收藏 0 点赞 0 评论 0
protected BrokerViewMBean getProxyToBroker() throws MalformedObjectNameException, JMSException {
    ObjectName brokerViewMBean = new ObjectName(
        "org.apache.activemq:type=Broker,brokerName=" + brokerService.getBrokerName());
    BrokerViewMBean proxy = (BrokerViewMBean) brokerService.getManagementContext()
            .newProxyInstance(brokerViewMBean, BrokerViewMBean.class, true);
    return proxy;
}
Scheduler.java 文件源码 项目:sepatools 阅读 22 收藏 0 点赞 0 评论 0
public Scheduler(EngineProperties properties,Processor processor) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
    requestHandler = new RequestResponseHandler(properties);
    tokenHandler = new TokenHandler(properties);

    if (processor == null) logger.error("Processor is null");
    else {
        this.processor = processor;
        this.processor.addObserver(this);
    }
}
Engine.java 文件源码 项目:sepatools 阅读 26 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, FileNotFoundException, NoSuchElementException, IOException {
    System.out.println("##########################################################################################");
    System.out.println("# SEPA Engine Ver 0.6  Copyright (C) 2016-2017                                           #");
    System.out.println("# University of Bologna (Italy)                                                          #");
    System.out.println("#                                                                                        #");
    System.out.println("# This program comes with ABSOLUTELY NO WARRANTY                                         #");                                    
    System.out.println("# This is free software, and you are welcome to redistribute it under certain conditions #");
    System.out.println("# GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007                                    #");
    System.out.println("#                                                                                        #");
    System.out.println("# GitHub: https://github.com/vaimee/sepatools                                            #");
    System.out.println("# Web: http://wot.arces.unibo.it                                                         #");
    System.out.println("##########################################################################################");
    System.out.println("");     
    System.out.println("Dependencies");
    System.out.println("com.google.code.gson          2.8.0       Apache 2.0");
    System.out.println("com.nimbusds                  4.34.2      The Apache Software License, Version 2.0");
    System.out.println("commons-io                    2.5         Apache License, Version 2.0");
    System.out.println("commons-logging               1.2         The Apache Software License, Version 2.0");
    System.out.println("org.apache.httpcomponents     4.5.3       Apache License, Version 2.0");
    System.out.println("org.apache.httpcomponents     4.4.6       Apache License, Version 2.0");
    System.out.println("org.apache.logging.log4j      2.8.1       Apache License, Version 2.0");
    System.out.println("org.bouncycastle              1.56        Bouncy Castle Licence");
    System.out.println("org.eclipse.paho              1.1.1       Eclipse Public License - Version 1.0");
    System.out.println("org.glassfish.grizzly         2.3.30      CDDL+GPL");
    System.out.println("org.glassfish.tyrus.bundles   1.13.1      Dual license consisting of the CDDL v1.1 and GPL v2");
    System.out.println("org.jdom                      2.0.6       Similar to Apache License but with the acknowledgment clause removed");
    System.out.println("");

    //Engine creation and initialization
    Engine engine = new Engine();
    engine.init();

    //Starting main engine thread
    engine.start();
}


问题


面经


文章

微信
公众号

扫码关注公众号