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


Java ObjectFactory.findProviderClass方法代码示例

本文整理汇总了Java中com.sun.org.apache.xalan.internal.utils.ObjectFactory.findProviderClass方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectFactory.findProviderClass方法的具体用法?Java ObjectFactory.findProviderClass怎么用?Java ObjectFactory.findProviderClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.org.apache.xalan.internal.utils.ObjectFactory的用法示例。


在下文中一共展示了ObjectFactory.findProviderClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkJAXPVersion

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Report version information about JAXP interfaces.
 *
 * Currently distinguishes between JAXP 1.0.1 and JAXP 1.1,
 * and not found; only tests the interfaces, and does not
 * check for reference implementation versions.
 *
 * @param h Map to put information in
 */
protected void checkJAXPVersion(Map<String, Object> h)
{

  if (null == h)
    h = new HashMap<>();

  Class clazz = null;

  try
  {
    final String JAXP1_CLASS = "javax.xml.stream.XMLStreamConstants";

    clazz = ObjectFactory.findProviderClass(JAXP1_CLASS, true);

    // If we succeeded, we have JAXP 1.4 available
    h.put(VERSION + "JAXP", "1.4");
  }
  catch (Exception e)
  {
      h.put(ERROR + VERSION + "JAXP", "1.3");
      h.put(ERROR, ERROR_FOUND);
    }
    }
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:33,代码来源:EnvironmentCheck.java

示例2: checkAntVersion

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Report product version information from Ant.
 *
 * @param h Map to put information in
 */
protected void checkAntVersion(Map<String, Object> h)
{

  if (null == h)
    h = new HashMap<>();

  try
  {
    final String ANT_VERSION_CLASS = "org.apache.tools.ant.Main";
    final String ANT_VERSION_METHOD = "getAntVersion"; // noArgs
    final Class noArgs[] = new Class[0];

    Class clazz = ObjectFactory.findProviderClass(ANT_VERSION_CLASS, true);

    Method method = clazz.getMethod(ANT_VERSION_METHOD, noArgs);
    Object returnValue = method.invoke(null, new Object[0]);

    h.put(VERSION + "ant", (String)returnValue);
  }
  catch (Exception e)
  {
    h.put(VERSION + "ant", CLASS_NOTPRESENT);
  }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:30,代码来源:EnvironmentCheck.java

示例3: checkDOML3

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Report version info from DOM interfaces.
 *
 * @param h Map to put information in
 */
protected boolean checkDOML3(Map<String, Object> h)
{

  if (null == h)
    h = new HashMap<>();

  final String DOM_CLASS = "org.w3c.dom.Document";
  final String DOM_LEVEL3_METHOD = "getDoctype";  // no parameter

  try
  {
    Class clazz = ObjectFactory.findProviderClass(DOM_CLASS, true);

    Method method = clazz.getMethod(DOM_LEVEL3_METHOD, (Class<?>[])null);

    // If we succeeded, we have loaded interfaces from a
    //  level 3 DOM somewhere
    h.put(VERSION + "DOM", "3.0");
    return true;
  }
  catch (Exception e)
  {
    return false;
  }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:31,代码来源:EnvironmentCheck.java

示例4: checkJAXPVersion

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Report version information about JAXP interfaces.
 *
 * Currently distinguishes between JAXP 1.0.1 and JAXP 1.1,
 * and not found; only tests the interfaces, and does not
 * check for reference implementation versions.
 *
 * @param h Hashtable to put information in
 */
protected void checkJAXPVersion(Hashtable h)
{

  if (null == h)
    h = new Hashtable();

  Class clazz = null;

  try
  {
    final String JAXP1_CLASS = "javax.xml.stream.XMLStreamConstants";

    clazz = ObjectFactory.findProviderClass(JAXP1_CLASS, true);

    // If we succeeded, we have JAXP 1.4 available
    h.put(VERSION + "JAXP", "1.4");
  }
  catch (Exception e)
  {
      h.put(ERROR + VERSION + "JAXP", "1.3");
      h.put(ERROR, ERROR_FOUND);
    }
    }
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:33,代码来源:EnvironmentCheck.java

示例5: checkAntVersion

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Report product version information from Ant.
 *
 * @param h Hashtable to put information in
 */
protected void checkAntVersion(Hashtable h)
{

  if (null == h)
    h = new Hashtable();

  try
  {
    final String ANT_VERSION_CLASS = "org.apache.tools.ant.Main";
    final String ANT_VERSION_METHOD = "getAntVersion"; // noArgs
    final Class noArgs[] = new Class[0];

    Class clazz = ObjectFactory.findProviderClass(ANT_VERSION_CLASS, true);

    Method method = clazz.getMethod(ANT_VERSION_METHOD, noArgs);
    Object returnValue = method.invoke(null, new Object[0]);

    h.put(VERSION + "ant", (String)returnValue);
  }
  catch (Exception e)
  {
    h.put(VERSION + "ant", CLASS_NOTPRESENT);
  }
}
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:30,代码来源:EnvironmentCheck.java

示例6: checkDOML3

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Report version info from DOM interfaces.
 *
 * @param h Hashtable to put information in
 */
protected boolean checkDOML3(Hashtable h)
{

  if (null == h)
    h = new Hashtable();

  final String DOM_CLASS = "org.w3c.dom.Document";
  final String DOM_LEVEL3_METHOD = "getDoctype";  // no parameter

  try
  {
    Class clazz = ObjectFactory.findProviderClass(DOM_CLASS, true);

    Method method = clazz.getMethod(DOM_LEVEL3_METHOD, (Class<?>[])null);

    // If we succeeded, we have loaded interfaces from a
    //  level 3 DOM somewhere
    h.put(VERSION + "DOM", "3.0");
    return true;
  }
  catch (Exception e)
  {
    return false;
  }
}
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:31,代码来源:EnvironmentCheck.java

示例7: getDTMManagerClass

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
public static Class getDTMManagerClass(boolean useServicesMechanism) {
    Class mgrClass = null;
    if (useServicesMechanism) {
        mgrClass = ObjectFactory.lookUpFactoryClass(DEFAULT_PROP_NAME,
                                                      null,
                                                      DEFAULT_CLASS_NAME);
    } else {
        try {
            mgrClass = ObjectFactory.findProviderClass(DEFAULT_CLASS_NAME, true);
        } catch (Exception e) {
            //will not happen
        }
    }
    // If no class found, default to this one.  (This should never happen -
    // the ObjectFactory has already been told that the current class is
    // the default).
    return (mgrClass != null) ? mgrClass : XSLTCDTMManager.class;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:19,代码来源:XSLTCDTMManager.java

示例8: checkEnvironmentUsingWhich

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Private worker method to attempt to use org.apache.env.Which.
 *
 * @param myContext an <code>ExpressionContext</code> passed in by the
 *                  extension mechanism.  This must be an XPathContext.
 * @param factoryDocument providing createElement services, etc.
 * @return a Node with environment info; null if any error
 */
private static Node checkEnvironmentUsingWhich(ExpressionContext myContext,
      Document factoryDocument)
{
  final String WHICH_CLASSNAME = "org.apache.env.Which";
  final String WHICH_METHODNAME = "which";
  final Class WHICH_METHOD_ARGS[] = { java.util.Hashtable.class,
                                      java.lang.String.class,
                                      java.lang.String.class };
  try
  {
    // Use reflection to try to find xml-commons utility 'Which'
    Class clazz = ObjectFactory.findProviderClass(WHICH_CLASSNAME, true);
    if (null == clazz)
      return null;

    // Fully qualify names since this is the only method they're used in
    java.lang.reflect.Method method = clazz.getMethod(WHICH_METHODNAME, WHICH_METHOD_ARGS);
    Hashtable report = new Hashtable();

    // Call the method with our Hashtable, common options, and ignore return value
    Object[] methodArgs = { report, "XmlCommons;Xalan;Xerces;Crimson;Ant", "" };
    Object returnValue = method.invoke(null, methodArgs);

    // Create a parent to hold the report and append hash to it
    Node resultNode = factoryDocument.createElement("checkEnvironmentExtension");
    com.sun.org.apache.xml.internal.utils.Hashtree2Node.appendHashToNode(report, "whichReport",
          resultNode, factoryDocument);

    return resultNode;
  }
  catch (Throwable t)
  {
    // Simply return null; no need to report error
    return null;
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:Extensions.java

示例9: ObjectType

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Used to represent a Java Class type such is required to support
 * non-static java functions.
 * @param javaClassName name of the class such as 'com.foo.Processor'
 */
protected ObjectType(String javaClassName) {
    _javaClassName = javaClassName;

    try {
      _clazz = ObjectFactory.findProviderClass(javaClassName, true);
    }
    catch (ClassNotFoundException e) {
      _clazz = null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:ObjectType.java

示例10: ObjectPool

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Constructor ObjectPool
 *
 * @param className Fully qualified name of the type of objects for this pool.
 */
public ObjectPool(String className)
{
  try
  {
    objectType = ObjectFactory.findProviderClass(className, true);
  }
  catch(ClassNotFoundException cnfe)
  {
    throw new WrappedRuntimeException(cnfe);
  }
  freeStack = new ArrayList();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:ObjectPool.java

示例11: hasMethods

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * for external java functions only: reports on whether or not
 * the specified method is found in the specifed class.
 */
private boolean hasMethods() {
    LiteralExpr arg = (LiteralExpr)_arg;

    // Get the class name from the namespace uri
    String className = getClassNameFromUri(_namespaceOfFunct);

    // Get the method name from the argument to function-available
    String methodName = null;
    int colonIndex = _nameOfFunct.indexOf(":");
    if (colonIndex > 0) {
      String functionName = _nameOfFunct.substring(colonIndex+1);
      int lastDotIndex = functionName.lastIndexOf('.');
      if (lastDotIndex > 0) {
        methodName = functionName.substring(lastDotIndex+1);
        if (className != null && !className.equals(""))
          className = className + "." + functionName.substring(0, lastDotIndex);
        else
          className = functionName.substring(0, lastDotIndex);
      }
      else
        methodName = functionName;
    }
    else
      methodName = _nameOfFunct;

    if (className == null || methodName == null) {
        return false;
    }

    // Replace the '-' characters in the method name
    if (methodName.indexOf('-') > 0)
      methodName = replaceDash(methodName);

    try {
        final Class clazz = ObjectFactory.findProviderClass(className, true);

        if (clazz == null) {
            return false;
        }

        final Method[] methods = clazz.getMethods();

        for (int i = 0; i < methods.length; i++) {
            final int mods = methods[i].getModifiers();

            if (Modifier.isPublic(mods) && Modifier.isStatic(mods)
                    && methods[i].getName().equals(methodName))
            {
                return true;
            }
        }
    }
    catch (ClassNotFoundException e) {
      return false;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:62,代码来源:FunctionAvailableCall.java

示例12: IncrementalSAXSource_Xerces

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/** Create a IncrementalSAXSource_Xerces, and create a SAXParser
 * to go with it. Xerces2 incremental parsing is only supported if
 * this constructor is used, due to limitations in the Xerces2 API (as of
 * Beta 3). If you don't like that restriction, tell the Xerces folks that
 * there should be a simpler way to request incremental SAX parsing.
 * */
public IncrementalSAXSource_Xerces()
              throws NoSuchMethodException
      {
              try
              {
                      // Xerces-2 incremental parsing support (as of Beta 3)
                      // ContentHandlers still get set on fIncrementalParser (to get
                      // conversion from XNI events to SAX events), but
                      // _control_ for incremental parsing must be exercised via the config.
                      //
                      // At this time there's no way to read the existing config, only
                      // to assert a new one... and only when creating a brand-new parser.
                      //
                      // Reflection is used to allow us to continue to compile against
                      // Xerces1. If/when we can abandon the older versions of the parser,
                      // this will simplify significantly.

                      // If we can't get the magic constructor, no need to look further.
                      Class xniConfigClass=ObjectFactory.findProviderClass(
                          "com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration",
                          true);
                      Class[] args1={xniConfigClass};
                      Constructor ctor=SAXParser.class.getConstructor(args1);

                      // Build the parser configuration object. StandardParserConfiguration
                      // happens to implement XMLPullParserConfiguration, which is the API
                      // we're going to want to use.
                      Class xniStdConfigClass=ObjectFactory.findProviderClass(
                          "com.sun.org.apache.xerces.internal.parsers.StandardParserConfiguration",
                          true);
                      fPullParserConfig=xniStdConfigClass.newInstance();
                      Object[] args2={fPullParserConfig};
                      fIncrementalParser = (SAXParser)ctor.newInstance(args2);

                      // Preload all the needed the configuration methods... I want to know they're
                      // all here before we commit to trying to use them, just in case the
                      // API changes again.
                      Class fXniInputSourceClass=ObjectFactory.findProviderClass(
                          "com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource",
                          true);
                      Class[] args3={fXniInputSourceClass};
                      fConfigSetInput=xniStdConfigClass.getMethod("setInputSource",args3);

                      Class[] args4={String.class,String.class,String.class};
                      fConfigInputSourceCtor=fXniInputSourceClass.getConstructor(args4);
                      Class[] args5={java.io.InputStream.class};
                      fConfigSetByteStream=fXniInputSourceClass.getMethod("setByteStream",args5);
                      Class[] args6={java.io.Reader.class};
                      fConfigSetCharStream=fXniInputSourceClass.getMethod("setCharacterStream",args6);
                      Class[] args7={String.class};
                      fConfigSetEncoding=fXniInputSourceClass.getMethod("setEncoding",args7);

                      Class[] argsb={Boolean.TYPE};
                      fConfigParse=xniStdConfigClass.getMethod("parse",argsb);
                      Class[] noargs=new Class[0];
                      fReset=fIncrementalParser.getClass().getMethod("reset",noargs);
              }
              catch(Exception e)
              {
          // Fallback if this fails (implemented in createIncrementalSAXSource) is
                      // to attempt Xerces-1 incremental setup. Can't do tail-call in
                      // constructor, so create new, copy Xerces-1 initialization,
                      // then throw it away... Ugh.
                      IncrementalSAXSource_Xerces dummy=new IncrementalSAXSource_Xerces(new SAXParser());
                      this.fParseSomeSetup=dummy.fParseSomeSetup;
                      this.fParseSome=dummy.fParseSome;
                      this.fIncrementalParser=dummy.fIncrementalParser;
              }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:76,代码来源:IncrementalSAXSource_Xerces.java

示例13: IncrementalSAXSource_Xerces

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/** Create a IncrementalSAXSource_Xerces, and create a SAXParser
 * to go with it. Xerces2 incremental parsing is only supported if
 * this constructor is used, due to limitations in the Xerces2 API (as of
 * Beta 3). If you don't like that restriction, tell the Xerces folks that
 * there should be a simpler way to request incremental SAX parsing.
 * */
public IncrementalSAXSource_Xerces()
              throws NoSuchMethodException
      {
              try
              {
                      // This should be cleaned up and the use of reflection
                      // removed - see JDK-8129880

                      // Xerces-2 incremental parsing support (as of Beta 3)
                      // ContentHandlers still get set on fIncrementalParser (to get
                      // conversion from XNI events to SAX events), but
                      // _control_ for incremental parsing must be exercised via the config.
                      //
                      // At this time there's no way to read the existing config, only
                      // to assert a new one... and only when creating a brand-new parser.
                      //
                      // Reflection is used to allow us to continue to compile against
                      // Xerces1. If/when we can abandon the older versions of the parser,
                      // this will simplify significantly.

                      // If we can't get the magic constructor, no need to look further.
                      Class xniConfigClass=ObjectFactory.findProviderClass(
                          "com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration",
                          true);
                      Class[] args1={xniConfigClass};
                      Constructor ctor=SAXParser.class.getConstructor(args1);

                      // Build the parser configuration object. StandardParserConfiguration
                      // happens to implement XMLPullParserConfiguration, which is the API
                      // we're going to want to use.
                      Class xniStdConfigClass=ObjectFactory.findProviderClass(
                          "com.sun.org.apache.xerces.internal.parsers.StandardParserConfiguration",
                          true);
                      fPullParserConfig=xniStdConfigClass.getConstructor().newInstance();
                      Object[] args2={fPullParserConfig};
                      fIncrementalParser = (SAXParser)ctor.newInstance(args2);

                      // Preload all the needed the configuration methods... I want to know they're
                      // all here before we commit to trying to use them, just in case the
                      // API changes again.
                      Class fXniInputSourceClass=ObjectFactory.findProviderClass(
                          "com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource",
                          true);
                      Class[] args3={fXniInputSourceClass};
                      fConfigSetInput=xniStdConfigClass.getMethod("setInputSource",args3);

                      Class[] args4={String.class,String.class,String.class};
                      fConfigInputSourceCtor=fXniInputSourceClass.getConstructor(args4);
                      Class[] args5={java.io.InputStream.class};
                      fConfigSetByteStream=fXniInputSourceClass.getMethod("setByteStream",args5);
                      Class[] args6={java.io.Reader.class};
                      fConfigSetCharStream=fXniInputSourceClass.getMethod("setCharacterStream",args6);
                      Class[] args7={String.class};
                      fConfigSetEncoding=fXniInputSourceClass.getMethod("setEncoding",args7);

                      Class[] argsb={Boolean.TYPE};
                      fConfigParse=xniStdConfigClass.getMethod("parse",argsb);
                      Class[] noargs=new Class[0];
                      fReset=fIncrementalParser.getClass().getMethod("reset",noargs);
              }
              catch(Exception e)
              {
          // Fallback if this fails (implemented in createIncrementalSAXSource) is
                      // to attempt Xerces-1 incremental setup. Can't do tail-call in
                      // constructor, so create new, copy Xerces-1 initialization,
                      // then throw it away... Ugh.
                      IncrementalSAXSource_Xerces dummy=new IncrementalSAXSource_Xerces(new SAXParser());
                      this.fParseSomeSetup=dummy.fParseSomeSetup;
                      this.fParseSome=dummy.fParseSome;
                      this.fIncrementalParser=dummy.fIncrementalParser;
              }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:79,代码来源:IncrementalSAXSource_Xerces.java

示例14: IncrementalSAXSource_Xerces

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/** Create a IncrementalSAXSource_Xerces, and create a SAXParser
 * to go with it. Xerces2 incremental parsing is only supported if
 * this constructor is used, due to limitations in the Xerces2 API (as of
 * Beta 3). If you don't like that restriction, tell the Xerces folks that
 * there should be a simpler way to request incremental SAX parsing.
 * */
public IncrementalSAXSource_Xerces()
              throws NoSuchMethodException
      {
              try
              {
                      // This should be cleaned up and the use of reflection
                      // removed - see JDK-8129880

                      // Xerces-2 incremental parsing support (as of Beta 3)
                      // ContentHandlers still get set on fIncrementalParser (to get
                      // conversion from XNI events to SAX events), but
                      // _control_ for incremental parsing must be exercised via the config.
                      //
                      // At this time there's no way to read the existing config, only
                      // to assert a new one... and only when creating a brand-new parser.
                      //
                      // Reflection is used to allow us to continue to compile against
                      // Xerces1. If/when we can abandon the older versions of the parser,
                      // this will simplify significantly.

                      // If we can't get the magic constructor, no need to look further.
                      Class xniConfigClass=ObjectFactory.findProviderClass(
                          "com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration",
                          true);
                      Class[] args1={xniConfigClass};
                      Constructor ctor=SAXParser.class.getConstructor(args1);

                      // Build the parser configuration object. StandardParserConfiguration
                      // happens to implement XMLPullParserConfiguration, which is the API
                      // we're going to want to use.
                      Class xniStdConfigClass=ObjectFactory.findProviderClass(
                          "com.sun.org.apache.xerces.internal.parsers.StandardParserConfiguration",
                          true);
                      fPullParserConfig=xniStdConfigClass.newInstance();
                      Object[] args2={fPullParserConfig};
                      fIncrementalParser = (SAXParser)ctor.newInstance(args2);

                      // Preload all the needed the configuration methods... I want to know they're
                      // all here before we commit to trying to use them, just in case the
                      // API changes again.
                      Class fXniInputSourceClass=ObjectFactory.findProviderClass(
                          "com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource",
                          true);
                      Class[] args3={fXniInputSourceClass};
                      fConfigSetInput=xniStdConfigClass.getMethod("setInputSource",args3);

                      Class[] args4={String.class,String.class,String.class};
                      fConfigInputSourceCtor=fXniInputSourceClass.getConstructor(args4);
                      Class[] args5={java.io.InputStream.class};
                      fConfigSetByteStream=fXniInputSourceClass.getMethod("setByteStream",args5);
                      Class[] args6={java.io.Reader.class};
                      fConfigSetCharStream=fXniInputSourceClass.getMethod("setCharacterStream",args6);
                      Class[] args7={String.class};
                      fConfigSetEncoding=fXniInputSourceClass.getMethod("setEncoding",args7);

                      Class[] argsb={Boolean.TYPE};
                      fConfigParse=xniStdConfigClass.getMethod("parse",argsb);
                      Class[] noargs=new Class[0];
                      fReset=fIncrementalParser.getClass().getMethod("reset",noargs);
              }
              catch(Exception e)
              {
          // Fallback if this fails (implemented in createIncrementalSAXSource) is
                      // to attempt Xerces-1 incremental setup. Can't do tail-call in
                      // constructor, so create new, copy Xerces-1 initialization,
                      // then throw it away... Ugh.
                      IncrementalSAXSource_Xerces dummy=new IncrementalSAXSource_Xerces(new SAXParser());
                      this.fParseSomeSetup=dummy.fParseSomeSetup;
                      this.fParseSome=dummy.fParseSome;
                      this.fIncrementalParser=dummy.fIncrementalParser;
              }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:79,代码来源:IncrementalSAXSource_Xerces.java

示例15: checkDOMVersion

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入方法依赖的package包/类
/**
 * Report version info from DOM interfaces.
 *
 * Currently distinguishes between pre-DOM level 2, the DOM
 * level 2 working draft, the DOM level 2 final draft,
 * and not found.
 *
 * @param h Map to put information in
 */
protected void checkDOMVersion(Map<String, Object> h)
{

  if (null == h)
    h = new HashMap<>();

  final String DOM_LEVEL2_CLASS = "org.w3c.dom.Document";
  final String DOM_LEVEL2_METHOD = "createElementNS";  // String, String
  final String DOM_LEVEL3_METHOD = "getDoctype";  // no parameter
  final String DOM_LEVEL2WD_CLASS = "org.w3c.dom.Node";
  final String DOM_LEVEL2WD_METHOD = "supported";  // String, String
  final String DOM_LEVEL2FD_CLASS = "org.w3c.dom.Node";
  final String DOM_LEVEL2FD_METHOD = "isSupported";  // String, String
  final Class twoStringArgs[] = { java.lang.String.class,
                                  java.lang.String.class };

  try
  {
    Class clazz = ObjectFactory.findProviderClass(DOM_LEVEL2_CLASS, true);

    Method method = clazz.getMethod(DOM_LEVEL2_METHOD, twoStringArgs);

    // If we succeeded, we have loaded interfaces from a
    //  level 2 DOM somewhere
    h.put(VERSION + "DOM", "2.0");

    try
    {
      // Check for the working draft version, which is
      //  commonly found, but won't work anymore
      clazz = ObjectFactory.findProviderClass(DOM_LEVEL2WD_CLASS, true);

      method = clazz.getMethod(DOM_LEVEL2WD_METHOD, twoStringArgs);

      h.put(ERROR + VERSION + "DOM.draftlevel", "2.0wd");
      h.put(ERROR, ERROR_FOUND);
    }
    catch (Exception e2)
    {
      try
      {
        // Check for the final draft version as well
        clazz = ObjectFactory.findProviderClass(DOM_LEVEL2FD_CLASS, true);

        method = clazz.getMethod(DOM_LEVEL2FD_METHOD, twoStringArgs);

        h.put(VERSION + "DOM.draftlevel", "2.0fd");
      }
      catch (Exception e3)
      {
        h.put(ERROR + VERSION + "DOM.draftlevel", "2.0unknown");
        h.put(ERROR, ERROR_FOUND);
      }
    }
  }
  catch (Exception e)
  {
    h.put(ERROR + VERSION + "DOM",
          "ERROR attempting to load DOM level 2 class: " + e.toString());
    h.put(ERROR, ERROR_FOUND);
  }

  //@todo load an actual DOM implmementation and query it as well
  //@todo load an actual DOM implmementation and check if
  //  isNamespaceAware() == true, which is needed to parse
  //  xsl stylesheet files into a DOM
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:77,代码来源:EnvironmentCheck.java


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