Java 类javax.management.MalformedObjectNameException 实例源码

项目:monarch    文件:LauncherLifecycleCommands.java   
private String getCurrentLocators() throws MalformedObjectNameException {
  String delimitedLocators = "";
  try {
    if (isConnectedAndReady()) {
      final DistributedSystemMXBean dsMBeanProxy = getDistributedSystemMXBean();
      if (dsMBeanProxy != null) {
        final String[] locators = dsMBeanProxy.listLocators();
        if (locators != null && locators.length > 0) {
          final StringBuilder sb = new StringBuilder();
          for (int i = 0; i < locators.length; i++) {
            if (i > 0) {
              sb.append(",");
            }
            sb.append(locators[i]);
          }
          delimitedLocators = sb.toString();
        }
      }
    }
  } catch (IOException e) { // thrown by getDistributedSystemMXBean
    // leave delimitedLocators = ""
    getGfsh().logWarning("DistributedSystemMXBean is unavailable\n", e);
  }
  return delimitedLocators;
}
项目:hadoop    文件:ClusterJspHelper.java   
public NamenodeStatus getNamenodeStatus(String props) throws IOException,
    MalformedObjectNameException, NumberFormatException {
  NamenodeStatus nn = new NamenodeStatus();
  nn.host = host;
  nn.filesAndDirectories = getProperty(props, "TotalFiles").getLongValue();
  nn.capacity = getProperty(props, "Total").getLongValue();
  nn.free = getProperty(props, "Free").getLongValue();
  nn.bpUsed = getProperty(props, "BlockPoolUsedSpace").getLongValue();
  nn.nonDfsUsed = getProperty(props, "NonDfsUsedSpace").getLongValue();
  nn.blocksCount = getProperty(props, "TotalBlocks").getLongValue();
  nn.missingBlocksCount = getProperty(props, "NumberOfMissingBlocks")
      .getLongValue();
  nn.httpAddress = httpAddress.toURL();
  getLiveNodeCount(getProperty(props, "LiveNodes").asText(), nn);
  getDeadNodeCount(getProperty(props, "DeadNodes").asText(), nn);
  nn.softwareVersion = getProperty(props, "SoftwareVersion").getTextValue();
  return nn;
}
项目:lazycat    文件:MemoryUserDatabaseMBean.java   
/**
 * 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;
    }

}
项目:lazycat    文件:GroupMBean.java   
/**
 * Return the MBean Names of all authorized roles for this group.
 */
public String[] getRoles() {

    Group group = (Group) this.resource;
    ArrayList<String> results = new ArrayList<String>();
    Iterator<Role> roles = group.getRoles();
    while (roles.hasNext()) {
        Role role = null;
        try {
            role = roles.next();
            ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), role);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException(
                    "Cannot create object name for role " + role);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:sepatools    文件:Engine.java   
public boolean init() throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, FileNotFoundException, NoSuchElementException, IOException {         
    //Initialize SPARQL 1.1 processing service properties
    endpointProperties = new SPARQL11Properties("endpoint.jpar");

    //Initialize SPARQL 1.1 SE processing service properties
    engineProperties = new EngineProperties("engine.jpar");

    //SPARQL 1.1 SE request processor
    processor = new Processor(endpointProperties);

    //SPARQL 1.1 SE request scheduler
    scheduler = new Scheduler(engineProperties,processor);

    //SPARQL 1.1 Protocol handlers
    httpGate = new HTTPGate(engineProperties,scheduler);
    httpsGate = new HTTPSGate(engineProperties,scheduler,am);

    //SPARQL 1.1 SE Protocol handler for WebSocket based subscriptions
    websocketApp = new WSGate(engineProperties,scheduler);
    secureWebsocketApp = new WSSGate(engineProperties,scheduler,am);

       return true;
}
项目:Pogamut3    文件:Test01_Jmx.java   
@Test
public void changeExportedFolderRemotely() throws MalformedURLException, IOException, MalformedObjectNameException, IntrospectionException {
    // connect through RMI and get the proxy
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/server");
    JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
    MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
    ObjectName agentName = ObjectName.getInstance("myDomain:name=Alice,type=tutorial");
    /*DynamicMBean proxy = JMX.newMBeanProxy(mbs, 
            agentName,
            DynamicMBean.class);
    */
    DynamicProxy proxy = new DynamicProxy(agentName, mbsc);
     // convert the proxy to standard Folder

    Folder jmxFolder = new DynamicMBeanToFolderAdapter(proxy);
    //jmxFolder.getProperty("name").setValue("Cecil Corn");
    String newName = "Cecil Corn";
    jmxFolder.getFolder("knows").getProperty("name").setValue(newName);
    //mbsc.setAttribute(agentName, new Attribute("name", "Bob"));

   // waitForEnterPressed();
    assertTrue(person.knows.name.equals(newName));
    System.out.println("---/// TEST OK ///---");
}
项目:apache-tomcat-7.0.73-with-comment    文件:MemoryUserDatabaseMBean.java   
/**
 * Return the MBean Name for the specified role name (if any);
 * otherwise return <code>null</code>.
 *
 * @param rolename Role name to look up
 */
public String findRole(String rolename) {

    UserDatabase database = (UserDatabase) this.resource;
    Role role = database.findRole(rolename);
    if (role == null) {
        return (null);
    }
    try {
        ObjectName oname =
            MBeanUtils.createObjectName(managedRole.getDomain(), role);
        return (oname.toString());
    } catch (MalformedObjectNameException e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Cannot create object name for role [" + rolename + "]");
        iae.initCause(e);
        throw iae;
    }

}
项目:apache-tomcat-7.0.73-with-comment    文件:MemoryUserDatabaseMBean.java   
/**
 * 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;
    }

}
项目:jerrydog    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource references for this
 * application.
 */
public String[] getResources() {

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

}
项目:uavstack    文件:BaseJMXMonitorDataCatchWorker.java   
/**
 * scan out all monitor MBeans
 *
 * @param mbsc
 * @return
 * @throws IOException
 */
protected Set<ObjectInstance> scanMBeans(MBeanServerConnection mbsc, String pattern) throws IOException {

    Set<ObjectInstance> monitorMBeans = null;
    int count = 2;
    while (count > 0) {
        try {
            monitorMBeans = mbsc.queryMBeans(new ObjectName(pattern), null);

            if (monitorMBeans == null || monitorMBeans.isEmpty()) {
                ThreadHelper.suspend(2000);
            }
            else {
                break;
            }

        }
        catch (MalformedObjectNameException e) {
            // ignore
        }
        count--;
    }

    return monitorMBeans;
}
项目:apache-tomcat-7.0.73-with-comment    文件:MemoryUserDatabaseMBean.java   
/**
 * 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;
    }

}
项目:apache-tomcat-7.0.73-with-comment    文件:AbstractProtocol.java   
private ObjectName createObjectName() throws MalformedObjectNameException {
    // Use the same domain as the connector
    domain = adapter.getDomain();

    if (domain == null) {
        return null;
    }

    StringBuilder name = new StringBuilder(getDomain());
    name.append(":type=ProtocolHandler,port=");
    int port = getPort();
    if (port > 0) {
        name.append(getPort());
    } else {
        name.append("auto-");
        name.append(getNameIndex());
    }
    InetAddress address = getAddress();
    if (address != null) {
        name.append(",address=");
        name.append(ObjectName.quote(address.getHostAddress()));
    }
    return new ObjectName(name.toString());
}
项目:tomcat7    文件:NamingResourcesMBean.java   
/**
 * 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<String> results = new ArrayList<String>();
    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 results.toArray(new String[results.size()]);

}
项目:tomcat7    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource references for this
 * application.
 */
public String[] getResources() {

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

}
项目:tomcat7    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource link references for 
 * this application.
 */
public String[] getResourceLinks() {

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

}
项目:tomcat7    文件:GroupMBean.java   
/**
 * Return the MBean Names of all authorized roles for this group.
 */
public String[] getRoles() {

    Group group = (Group) this.resource;
    ArrayList<String> results = new ArrayList<String>();
    Iterator<Role> roles = group.getRoles();
    while (roles.hasNext()) {
        Role role = null;
        try {
            role = roles.next();
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), role);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for role " + role);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:tomcat7    文件:UserMBean.java   
/**
 * Return the MBean Names of all groups this user is a member of.
 */
public String[] getGroups() {

    User user = (User) this.resource;
    ArrayList<String> results = new ArrayList<String>();
    Iterator<Group> groups = user.getGroups();
    while (groups.hasNext()) {
        Group group = null;
        try {
            group = groups.next();
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), group);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for group " + group);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:tomcat7    文件:UserMBean.java   
/**
 * Return the MBean Names of all roles assigned to this user.
 */
public String[] getRoles() {

    User user = (User) this.resource;
    ArrayList<String> results = new ArrayList<String>();
    Iterator<Role> roles = user.getRoles();
    while (roles.hasNext()) {
        Role role = null;
        try {
            role = roles.next();
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), role);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for role " + role);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:tomcat7    文件:MemoryUserDatabaseMBean.java   
/**
 * 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;
    }

}
项目:tomcat7    文件:MemoryUserDatabaseMBean.java   
/**
 * 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;
    }

}
项目:apache-tomcat-7.0.73-with-comment    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource references for this
 * application.
 */
public String[] getResources() {

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

}
项目:apache-tomcat-7.0.73-with-comment    文件:NamingResourcesMBean.java   
/**
 * 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<String> results = new ArrayList<String>();
    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 results.toArray(new String[results.size()]);

}
项目:tomcat7    文件:AbstractProtocol.java   
private ObjectName createObjectName() throws MalformedObjectNameException {
    // Use the same domain as the connector
    domain = adapter.getDomain();

    if (domain == null) {
        return null;
    }

    StringBuilder name = new StringBuilder(getDomain());
    name.append(":type=ProtocolHandler,port=");
    int port = getPort();
    if (port > 0) {
        name.append(getPort());
    } else {
        name.append("auto-");
        name.append(getNameIndex());
    }
    InetAddress address = getAddress();
    if (address != null) {
        name.append(",address=");
        name.append(ObjectName.quote(address.getHostAddress()));
    }
    return new ObjectName(name.toString());
}
项目:monarch    文件:MBeanServerConnectionRule.java   
/**
 * Retrieve a new proxy MBean
 *
 * @return A new proxy MBean of the same type with which the class was constructed
 */
public <T> T getProxyMBean(Class<T> proxyClass, String beanQueryName)
    throws MalformedObjectNameException, IOException {
  ObjectName name = null;
  QueryExp query = null;

  if (proxyClass != null) {
    query = Query.isInstanceOf(Query.value(proxyClass.getName()));
  }

  if (beanQueryName != null) {
    name = ObjectName.getInstance(beanQueryName);
  }

  Set<ObjectInstance> beans = con.queryMBeans(name, query);
  assertEquals("failed to find only one instance of type " + proxyClass.getName() + " with name "
      + beanQueryName, 1, beans.size());

  return JMX.newMXBeanProxy(con, ((ObjectInstance) beans.toArray()[0]).getObjectName(),
      proxyClass);
}
项目:jerrydog    文件:MemoryUserDatabaseMBean.java   
/**
 * 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) {
        throw new IllegalArgumentException
            ("Cannot create object name for user " + user);
    }

}
项目:lazycat    文件:UserMBean.java   
/**
 * Return the MBean Names of all groups this user is a member of.
 */
public String[] getGroups() {

    User user = (User) this.resource;
    ArrayList<String> results = new ArrayList<String>();
    Iterator<Group> groups = user.getGroups();
    while (groups.hasNext()) {
        Group group = null;
        try {
            group = groups.next();
            ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), group);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException(
                    "Cannot create object name for group " + group);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:lazycat    文件:AbstractProtocol.java   
private ObjectName createObjectName() throws MalformedObjectNameException {
    // Use the same domain as the connector
    domain = adapter.getDomain();

    if (domain == null) {
        return null;
    }

    StringBuilder name = new StringBuilder(getDomain());
    name.append(":type=ProtocolHandler,port=");
    int port = getPort();
    if (port > 0) {
        name.append(getPort());
    } else {
        name.append("auto-");
        name.append(getNameIndex());
    }
    InetAddress address = getAddress();
    if (address != null) {
        name.append(",address=");
        name.append(ObjectName.quote(address.getHostAddress()));
    }
    return new ObjectName(name.toString());
}
项目:apache-tomcat-7.0.73-with-comment    文件:GroupMBean.java   
/**
 * Return the MBean Names of all authorized roles for this group.
 */
public String[] getRoles() {

    Group group = (Group) this.resource;
    ArrayList<String> results = new ArrayList<String>();
    Iterator<Role> roles = group.getRoles();
    while (roles.hasNext()) {
        Role role = null;
        try {
            role = roles.next();
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), role);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for role " + role);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
项目:lazycat    文件:NamingResourcesMBean.java   
/**
 * 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<String> results = new ArrayList<String>();
    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 results.toArray(new String[results.size()]);

}
项目:lams    文件:NamingResourcesMBean.java   
/**
 * Return the MBean Names of all the defined resource references for this
 * application.
 */
public String[] getResources() {

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

}
项目:lams    文件:StandardContextMBean.java   
/**
 * 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()]));

}
项目:lams    文件:StandardContextMBean.java   
/**
 * 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()]));

}
项目:ZooKeeper    文件:MBeanRegistry.java   
/**
 * 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;
    }
}
项目:lams    文件:JmxServiceImpl.java   
@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 );
    }
}
项目:https-github.com-apache-zookeeper    文件:MBeanRegistry.java   
/**
 * 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;
    }
}
项目:jerrydog    文件:NamingResourcesMBean.java   
/**
 * 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()]));

}
项目:pooled-jms    文件:QpidJmsPoolTestSupport.java   
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;
}
项目:pooled-jms    文件:ActiveMQJmsPoolTestSupport.java   
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;
}
项目:sepatools    文件:Scheduler.java   
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);
    }
}
项目:sepatools    文件:Engine.java   
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();
}