本文整理汇总了Java中javax.management.MalformedObjectNameException类的典型用法代码示例。如果您正苦于以下问题:Java MalformedObjectNameException类的具体用法?Java MalformedObjectNameException怎么用?Java MalformedObjectNameException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MalformedObjectNameException类属于javax.management包,在下文中一共展示了MalformedObjectNameException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCurrentLocators
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
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;
}
示例2: getNamenodeStatus
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
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;
}
示例3: findGroup
import javax.management.MalformedObjectNameException; //导入依赖的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;
}
}
示例4: getRoles
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
/**
* 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()]);
}
示例5: init
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
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;
}
示例6: changeExportedFolderRemotely
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
@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 ///---");
}
示例7: findRole
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
/**
* 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;
}
}
示例8: findUser
import javax.management.MalformedObjectNameException; //导入依赖的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;
}
}
示例9: getResources
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
/**
* 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()]));
}
示例10: scanMBeans
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
/**
* 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;
}
示例11: findGroup
import javax.management.MalformedObjectNameException; //导入依赖的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;
}
}
示例12: createObjectName
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
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());
}
示例13: getEnvironments
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
/**
* 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()]);
}
示例14: getResources
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
/**
* 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()]);
}
示例15: getResourceLinks
import javax.management.MalformedObjectNameException; //导入依赖的package包/类
/**
* 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()]);
}