本文整理汇总了Java中javax.management.ObjectName.quote方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectName.quote方法的具体用法?Java ObjectName.quote怎么用?Java ObjectName.quote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.ObjectName
的用法示例。
在下文中一共展示了ObjectName.quote方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ConnectionBean
import javax.management.ObjectName; //导入方法依赖的package包/类
public ConnectionBean(ServerCnxn connection,ZooKeeperServer zk){
this.connection = connection;
this.stats = connection;
this.zk = zk;
InetSocketAddress sockAddr = connection.getRemoteSocketAddress();
if (sockAddr == null) {
remoteIP = "Unknown";
} else {
InetAddress addr = sockAddr.getAddress();
if (addr instanceof Inet6Address) {
remoteIP = ObjectName.quote(addr.getHostAddress());
} else {
remoteIP = addr.getHostAddress();
}
}
sessionId = connection.getSessionId();
}
示例2: getObjectNameKeyProperties
import javax.management.ObjectName; //导入方法依赖的package包/类
@Override
protected String getObjectNameKeyProperties() {
StringBuilder keyProperties =
new StringBuilder("j2eeType=Servlet,name=");
String name = getName();
if (Util.objectNameValueNeedsQuote(name)) {
name = ObjectName.quote(name);
}
keyProperties.append(name);
keyProperties.append(getWebModuleKeyProperties());
return keyProperties.toString();
}
示例3: getName
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* The name will be prefix-address-port if address is non-null and
* prefix-port if the address is null. The name will be appropriately quoted
* so it can be used directly in an ObjectName.
*/
public String getName() {
StringBuilder name = new StringBuilder(getNamePrefix());
name.append('-');
if (getAddress() != null) {
name.append(getAddress().getHostAddress());
name.append('-');
}
int port = getPort();
if (port == 0) {
// Auto binding is in use. Check if port is known
name.append("auto-");
name.append(getNameIndex());
port = getLocalPort();
if (port != -1) {
name.append('-');
name.append(port);
}
} else {
name.append(port);
}
return ObjectName.quote(name.toString());
}
示例4: getName
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* for example : http-bio-8080
* The name will be prefix-address-port if address is non-null and
* prefix-port if the address is null. The name will be appropriately quoted
* so it can be used directly in an ObjectName.
*/
public String getName() {
//http-bio for http1.1
StringBuilder name = new StringBuilder(getNamePrefix());
name.append('-');
if (getAddress() != null) {
name.append(getAddress().getHostAddress());
name.append('-');
}
//port是在digester填充Connector的port属性的时候设置的 很隐蔽
int port = getPort();
if (port == 0) {
// Auto binding is in use. Check if port is known
name.append("auto-");
name.append(getNameIndex());
port = getLocalPort();
if (port != -1) {
name.append('-');
name.append(port);
}
} else {
name.append(port);
}
return ObjectName.quote(name.toString());
}
示例5: registerJMX
import javax.management.ObjectName; //导入方法依赖的package包/类
private void registerJMX() {
String parentName = context.getName();
if (!parentName.startsWith("/")) {
parentName = "/" + parentName;
}
String hostName = context.getParent().getName();
hostName = (hostName == null) ? "DEFAULT" : hostName;
// domain == engine name
String domain = context.getParent().getParent().getName();
String webMod = "//" + hostName + parentName;
String onameStr = null;
String filterName = filterDef.getFilterName();
if (Util.objectNameValueNeedsQuote(filterName)) {
filterName = ObjectName.quote(filterName);
}
if (context instanceof StandardContext) {
StandardContext standardContext = (StandardContext) context;
onameStr = domain + ":j2eeType=Filter,name=" + filterName +
",WebModule=" + webMod + ",J2EEApplication=" +
standardContext.getJ2EEApplication() + ",J2EEServer=" +
standardContext.getJ2EEServer();
} else {
onameStr = domain + ":j2eeType=Filter,name=" + filterName +
",WebModule=" + webMod;
}
try {
oname = new ObjectName(onameStr);
Registry.getRegistry(null, null).registerComponent(this, oname,
null);
} catch (Exception ex) {
log.info(sm.getString("applicationFilterConfig.jmxRegisterFail",
getFilterClass(), getFilterName()), ex);
}
}
示例6: connectorMBeanNames
import javax.management.ObjectName; //导入方法依赖的package包/类
private static String[] connectorMBeanNames(String port, String type) {
return new String[] {
"Tomcat:type=Connector,port=" + port + ",address="
+ ObjectName.quote(ADDRESS),
"Tomcat:type=GlobalRequestProcessor,name="
+ ObjectName.quote("http-" + type + "-" + ADDRESS + "-" + port),
"Tomcat:type=Mapper,port=" + port + ",address="
+ ObjectName.quote(ADDRESS),
"Tomcat:type=ProtocolHandler,port=" + port + ",address="
+ ObjectName.quote(ADDRESS),
"Tomcat:type=ThreadPool,name="
+ ObjectName.quote("http-" + type + "-" + ADDRESS + "-" + port),
};
}
示例7: getObjectNameKeyProperties
import javax.management.ObjectName; //导入方法依赖的package包/类
@Override
protected String getObjectNameKeyProperties() {
StringBuilder keyProperties = new StringBuilder("j2eeType=Servlet,name=");
String name = getName();
if (Util.objectNameValueNeedsQuote(name)) {
name = ObjectName.quote(name);
}
keyProperties.append(name);
keyProperties.append(getWebModuleKeyProperties());
return keyProperties.toString();
}
示例8: makeCompliantRegionPath
import javax.management.ObjectName; //导入方法依赖的package包/类
public static String makeCompliantRegionPath(String value) {
if (isQuoted(value)) {
value = ObjectName.unquote(value);
} else {
if (containsSpecialChar(value)) {
value = ObjectName.quote(value);
}
}
return value;
}
示例9: registerJMX
import javax.management.ObjectName; //导入方法依赖的package包/类
private void registerJMX() {
String parentName = context.getName();
if (!parentName.startsWith("/")) {
parentName = "/" + parentName;
}
String hostName = context.getParent().getName();
hostName = (hostName == null) ? "DEFAULT" : hostName;
// domain == engine name
String domain = context.getParent().getParent().getName();
String webMod = "//" + hostName + parentName;
String onameStr = null;
String filterName = filterDef.getFilterName();
if (Util.objectNameValueNeedsQuote(filterName)) {
filterName = ObjectName.quote(filterName);
}
if (context instanceof StandardContext) {
StandardContext standardContext = (StandardContext) context;
onameStr = domain + ":j2eeType=Filter,name=" + filterName + ",WebModule=" + webMod + ",J2EEApplication="
+ standardContext.getJ2EEApplication() + ",J2EEServer=" + standardContext.getJ2EEServer();
} else {
onameStr = domain + ":j2eeType=Filter,name=" + filterName + ",WebModule=" + webMod;
}
try {
oname = new ObjectName(onameStr);
Registry.getRegistry(null, null).registerComponent(this, oname, null);
} catch (Exception ex) {
log.info(sm.getString("applicationFilterConfig.jmxRegisterFail", getFilterClass(), getFilterName()), ex);
}
}
示例10: requestMBeanNames
import javax.management.ObjectName; //导入方法依赖的package包/类
private static String[] requestMBeanNames(String port, String type) {
return new String[] {
"Tomcat:type=RequestProcessor,worker=" +
ObjectName.quote("http-" + type + "-" + ADDRESS + "-" + port) +
",name=HttpRequest1",
};
}
示例11: query
import javax.management.ObjectName; //导入方法依赖的package包/类
private static int query(MBeanServer mbs,
String pattern,
String[][] data) throws Exception {
int error = 0;
System.out.println("\nAttribute Value Pattern = " + pattern + "\n");
for (int i = 0; i < data.length; i++) {
ObjectName on = new ObjectName("domain:type=Simple,pattern=" +
ObjectName.quote(pattern) +
",name=" + i);
Simple s = new Simple(data[i][0]);
mbs.registerMBean(s, on);
QueryExp q =
Query.match(Query.attr("StringNumber"), Query.value(pattern));
q.setMBeanServer(mbs);
boolean r = q.apply(on);
System.out.print("Attribute Value = " +
mbs.getAttribute(on, "StringNumber"));
if (r && "OK".equals(data[i][1])) {
System.out.println(" OK");
} else if (!r && "KO".equals(data[i][1])) {
System.out.println(" KO");
} else {
System.out.println(" Error");
error++;
}
}
return error;
}
示例12: toString
import javax.management.ObjectName; //导入方法依赖的package包/类
@Override
public String toString() {
return "ConnectionBean{ClientIP=" + ObjectName.quote(getSourceIP())
+ ",SessionId=0x" + getSessionId() + "}";
}
示例13: quote
import javax.management.ObjectName; //导入方法依赖的package包/类
public static String quote(String text) {
return Pattern.compile("[:\",=*?]").matcher(text).find() ? ObjectName.quote(text) : text;
}
示例14: createObjectName
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create an <code>ObjectName</code> for this
* <code>Role</code> object.
*
* @param domain Domain in which this name is to be created
* @param role The Role to be named
*
* @exception MalformedObjectNameException if a name cannot be created
*/
static ObjectName createObjectName(String domain, Role role)
throws MalformedObjectNameException {
ObjectName name = new ObjectName(domain + ":type=Role,rolename=" +
ObjectName.quote(role.getRolename()) +
",database=" + role.getUserDatabase().getId());
return name;
}
示例15: createObjectName
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Create an <code>ObjectName</code> for this
* <code>User</code> object.
*
* @param domain Domain in which this name is to be created
* @param user The User to be named
*
* @exception MalformedObjectNameException if a name cannot be created
*/
static ObjectName createObjectName(String domain, User user)
throws MalformedObjectNameException {
ObjectName name = new ObjectName(domain + ":type=User,username=" +
ObjectName.quote(user.getUsername()) +
",database=" + user.getUserDatabase().getId());
return name;
}