org.apache.tomcat.util.modeler.Registry.getType()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(212)

本文整理了Java中org.apache.tomcat.util.modeler.Registry.getType方法的一些代码示例,展示了Registry.getType的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Registry.getType方法的具体详情如下:
包路径:org.apache.tomcat.util.modeler.Registry
类名称:Registry
方法名:getType

Registry.getType介绍

[英]Get the type of an attribute of the object, from the metadata.
[中]从元数据中获取对象属性的类型。

代码示例

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

public void setAttribute( PrintWriter writer,
             String onameStr, String att, String val )
{
  try {
    ObjectName oname=new ObjectName( onameStr );
    String type=registry.getType(oname, att);
    Object valueObj=registry.convertValue(type, val );
    mBeanServer.setAttribute( oname, new Attribute(att, valueObj));
    writer.println("OK - Attribute set");
  } catch( Exception ex ) {
    writer.println("Error - " + ex.toString());
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Sets an MBean attribute's value.
 */
private void setAttributeInternal(String onameStr, String attributeName, String value)
    throws OperationsException, MBeanException, ReflectionException {
  ObjectName oname = new ObjectName(onameStr);
  String type = registry.getType(oname, attributeName);
  Object valueObj = registry.convertValue(type, value);
  mBeanServer.setAttribute(oname, new Attribute(attributeName, valueObj));
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

public void setAttribute( PrintWriter writer,
             String onameStr, String att, String val )
{
  try {
    ObjectName oname=new ObjectName( onameStr );
    String type=registry.getType(oname, att);
    Object valueObj=registry.convertValue(type, val );
    mBeanServer.setAttribute( oname, new Attribute(att, valueObj));
    writer.println("OK - Attribute set");
  } catch( Exception ex ) {
    writer.println("Error - " + ex.toString());
    ex.printStackTrace(writer);
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

public void setAttribute( PrintWriter writer,
             String onameStr, String att, String val )
{
  try {
    ObjectName oname=new ObjectName( onameStr );
    String type=registry.getType(oname, att);
    Object valueObj=registry.convertValue(type, val );
    mBeanServer.setAttribute( oname, new Attribute(att, valueObj));
    writer.println("OK - Attribute set");
  } catch( Exception ex ) {
    writer.println("Error - " + ex.toString());
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

public void setAttribute( PrintWriter writer,
             String onameStr, String att, String val )
{
  try {
    ObjectName oname=new ObjectName( onameStr );
    String type=registry.getType(oname, att);
    Object valueObj=registry.convertValue(type, val );
    mBeanServer.setAttribute( oname, new Attribute(att, valueObj));
    writer.println("OK - Attribute set");
  } catch( Exception ex ) {
    writer.println("Error - " + ex.toString());
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Sets an MBean attribute's value.
 */
private void setAttributeInternal(String onameStr,
                 String attributeName,
                 String value)
  throws OperationsException, MBeanException, ReflectionException {
  ObjectName oname=new ObjectName( onameStr );
  String type=registry.getType(oname, attributeName);
  Object valueObj=registry.convertValue(type, value );
  mBeanServer.setAttribute( oname, new Attribute(attributeName, valueObj));
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Sets an MBean attribute's value.
 */
private void setAttributeInternal(String onameStr,
                 String attributeName,
                 String value)
  throws OperationsException, MBeanException, ReflectionException {
  ObjectName oname=new ObjectName( onameStr );
  String type=registry.getType(oname, attributeName);
  Object valueObj=registry.convertValue(type, value );
  mBeanServer.setAttribute( oname, new Attribute(attributeName, valueObj));
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Sets an MBean attribute's value.
 */
private void setAttributeInternal(String onameStr, String attributeName, String value)
    throws OperationsException, MBeanException, ReflectionException {
  ObjectName oname = new ObjectName(onameStr);
  String type = registry.getType(oname, attributeName);
  Object valueObj = registry.convertValue(type, value);
  mBeanServer.setAttribute(oname, new Attribute(attributeName, valueObj));
}

代码示例来源:origin: jboss.web/jbossweb

private void processAttribute(MBeanServer server,
               Node descN, String objectName ) {
  String attName=DomUtil.getAttribute(descN, "name");
  String value=DomUtil.getAttribute(descN, "value");
  String type=null; // DomUtil.getAttribute(descN, "type");
  if( value==null ) {
    // The value may be specified as CDATA
    value=DomUtil.getContent(descN);
  }
  try {
    if( log.isDebugEnabled())
      log.debug("Set attribute " + objectName + " " + attName +
          " " + value);
    ObjectName oname=new ObjectName(objectName);
    // find the type
    if( type==null )
      type=registry.getType(  oname, attName );
    if( type==null ) {
      log.info("Can't find attribute " + objectName + " " + attName );
    } else {
      Object valueO=registry.convertValue( type, value);
      server.setAttribute(oname, new Attribute(attName, valueO));
    }
  } catch( Exception ex) {
    log.error("Error processing attribute " + objectName + " " +
        attName + " " + value, ex);
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

private void processAttribute(MBeanServer server,
               Node descN, String objectName ) {
  String attName=DomUtil.getAttribute(descN, "name");
  String value=DomUtil.getAttribute(descN, "value");
  String type=null; // DomUtil.getAttribute(descN, "type");
  if( value==null ) {
    // The value may be specified as CDATA
    value=DomUtil.getContent(descN);
  }
  try {
    if( log.isDebugEnabled())
      log.debug("Set attribute " + objectName + " " + attName +
          " " + value);
    ObjectName oname=new ObjectName(objectName);
    // find the type
    if( type==null )
      type=registry.getType(  oname, attName );
    if( type==null ) {
      log.info("Can't find attribute " + objectName + " " + attName );
    } else {
      Object valueO=registry.convertValue( type, value);
      server.setAttribute(oname, new Attribute(attName, valueO));
    }
  } catch( Exception ex) {
    log.error("Error processing attribute " + objectName + " " +
        attName + " " + value, ex);
  }
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/util

private void processAttribute(MBeanServer server,
               Node descN, String objectName ) {
  String attName=DomUtil.getAttribute(descN, "name");
  String value=DomUtil.getAttribute(descN, "value");
  String type=null; // DomUtil.getAttribute(descN, "type");
  if( value==null ) {
    // The value may be specified as CDATA
    value=DomUtil.getContent(descN);
  }
  try {
    if( log.isDebugEnabled())
      log.debug("Set attribute " + objectName + " " + attName +
          " " + value);
    ObjectName oname=new ObjectName(objectName);
    // find the type
    type=registry.getType(  oname, attName );
    if( type==null ) {
      log.info("Can't find attribute " + objectName + " " + attName );
    } else {
      Object valueO=registry.convertValue( type, value);
      server.setAttribute(oname, new Attribute(attName, valueO));
    }
  } catch( Exception ex) {
    log.error("Error processing attribute " + objectName + " " +
        attName + " " + value, ex);
  }
}

代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote

private void processAttribute(MBeanServer server,
               Node descN, String objectName ) {
  String attName=DomUtil.getAttribute(descN, "name");
  String value=DomUtil.getAttribute(descN, "value");
  String type=null; // DomUtil.getAttribute(descN, "type");
  if( value==null ) {
    // The value may be specified as CDATA
    value=DomUtil.getContent(descN);
  }
  try {
    if( log.isDebugEnabled())
      log.debug("Set attribute " + objectName + " " + attName +
          " " + value);
    ObjectName oname=new ObjectName(objectName);
    // find the type
    type=registry.getType(  oname, attName );
    if( type==null ) {
      log.info("Can't find attribute " + objectName + " " + attName );
    } else {
      Object valueO=registry.convertValue( type, value);
      server.setAttribute(oname, new Attribute(attName, valueO));
    }
  } catch( Exception ex) {
    log.error("Error processing attribute " + objectName + " " +
        attName + " " + value, ex);
  }
}

代码示例来源:origin: org.apache.coyote.springsource/com.springsource.org.apache.coyote.springsource

private void processAttribute(MBeanServer server,
               Node descN, String objectName ) {
  String attName=DomUtil.getAttribute(descN, "name");
  String value=DomUtil.getAttribute(descN, "value");
  String type=null; // DomUtil.getAttribute(descN, "type");
  if( value==null ) {
    // The value may be specified as CDATA
    value=DomUtil.getContent(descN);
  }
  try {
    if( log.isDebugEnabled())
      log.debug("Set attribute " + objectName + " " + attName +
          " " + value);
    ObjectName oname=new ObjectName(objectName);
    // find the type
    if( type==null )
      type=registry.getType(  oname, attName );
    if( type==null ) {
      log.info("Can't find attribute " + objectName + " " + attName );
    } else {
      Object valueO=registry.convertValue( type, value);
      server.setAttribute(oname, new Attribute(attName, valueO));
    }
  } catch( Exception ex) {
    log.error("Error processing attribute " + objectName + " " +
        attName + " " + value, ex);
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

private void processAttribute(MBeanServer server,
               Node descN, String objectName ) {
  String attName=DomUtil.getAttribute(descN, "name");
  String value=DomUtil.getAttribute(descN, "value");
  String type=null; // DomUtil.getAttribute(descN, "type");
  if( value==null ) {
    // The value may be specified as CDATA
    value=DomUtil.getContent(descN);
  }
  try {
    if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled())
      CoyoteLogger.MODELER_LOGGER.debug("Set attribute " + objectName + " " + attName +
          " " + value);
    ObjectName oname=new ObjectName(objectName);
    // find the type
    if( type==null )
      type=registry.getType(  oname, attName );
    if( type==null ) {
      CoyoteLogger.MODELER_LOGGER.attributeNotFound(attName, objectName);
    } else {
      Object valueO=registry.convertValue( type, value);
      server.setAttribute(oname, new Attribute(attName, valueO));
    }
  } catch( Exception ex) {
    CoyoteLogger.MODELER_LOGGER.errorProcessingAttribute(attName, value, objectName, ex);
  }
}

相关文章