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


Java ObjectName.quote方法代码示例

本文整理汇总了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();
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:19,代码来源:ConnectionBean.java

示例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();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:StandardWrapper.java

示例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());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:AbstractProtocol.java

示例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());
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:31,代码来源:AbstractProtocol.java

示例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);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:38,代码来源:ApplicationFilterConfig.java

示例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),
    };
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:TestRegistration.java

示例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();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:16,代码来源:StandardWrapper.java

示例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;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:MBeanJMXAdapter.java

示例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);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:33,代码来源:ApplicationFilterConfig.java

示例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",
    };
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:8,代码来源:TestRegistration.java

示例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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:32,代码来源:QueryMatchTest.java

示例12: toString

import javax.management.ObjectName; //导入方法依赖的package包/类
@Override
public String toString() {
    return "ConnectionBean{ClientIP=" + ObjectName.quote(getSourceIP())
        + ",SessionId=0x" + getSessionId() + "}";
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:6,代码来源:ConnectionBean.java

示例13: quote

import javax.management.ObjectName; //导入方法依赖的package包/类
public static String quote(String text) {
    return Pattern.compile("[:\",=*?]").matcher(text).find() ? ObjectName.quote(text) : text;
}
 
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:4,代码来源:ManagementService.java

示例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;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:MBeanUtils.java

示例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;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:18,代码来源:MBeanUtils.java


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