/** * Finds the implementation Class object in the specified order. The * specified order is the following: * <ol> * <li>query the system property using <code>System.getProperty</code> * <li>read <code>META-INF/services/<i>factoryId</i></code> file * <li>use fallback classname * </ol> * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object
throws ConfigurationError String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass;
String systemProp = SecuritySupport.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; return findJarServiceProviderName(factoryId);
/** * 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, ObjectFactory.findClassLoader(), true); } catch (ClassNotFoundException e) { _clazz = null; } }
/** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } }
throws ConfigurationError Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) {
ClassLoader cl = findClassLoader(); debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); debugPrintln("found in resource, value=" + factoryClassName);
/** * Finds the implementation Class object in the specified order. The * specified order is the following: * <ol> * <li>query the system property using <code>System.getProperty</code> * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file * <li>read <code>META-INF/services/<i>factoryId</i></code> file * <li>use fallback classname * </ol> * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class
/** * 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, ObjectFactory.findClassLoader(), true); } catch (ClassNotFoundException e) { _clazz = null; } }
/** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } }
throws ConfigurationError Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) {
ClassLoader cl = findClassLoader(); debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); debugPrintln("found in resource, value=" + factoryClassName);
/** * Finds the implementation Class object in the specified order. The * specified order is the following: * <ol> * <li>query the system property using <code>System.getProperty</code> * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file * <li>read <code>META-INF/services/<i>factoryId</i></code> file * <li>use fallback classname * </ol> * * @return Class object of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param propertiesFilename The filename in the $java.home/lib directory * of the properties file. If none specified, * ${java.home}/lib/xalan.properties will be used. * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError { return lookUpFactoryClass(factoryId, null, null); } // lookUpFactoryClass(String):Class
throws ConfigurationError String factoryClassName = lookUpFactoryClassName(factoryId, propertiesFilename, fallbackClassName); ClassLoader cl = findClassLoader(); Class providerClass = findProviderClass(factoryClassName, cl, true); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return providerClass;
/** * 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, ObjectFactory.findClassLoader(), true); } catch (ClassNotFoundException e) { _clazz = null; } }
/** * Create an instance of a class using the specified ClassLoader */ static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } }
throws ConfigurationError Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename, fallbackClassName); debugPrintln("created new instance of factory " + factoryId); return instance; } catch (Exception x) {
ClassLoader cl = findClassLoader(); debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); debugPrintln("found in resource, value=" + factoryClassName);
String systemProp = SecuritySupport.getSystemProperty(factoryId); if (systemProp != null) { debugPrintln("found system property, value=" + systemProp); return systemProp; debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName); return factoryClassName; return findJarServiceProviderName(factoryId);
/** * Finds the implementation Class object in the specified order. The * specified order is the following: * <ol> * <li>query the system property using <code>System.getProperty</code> * <li>read <code>META-INF/services/<i>factoryId</i></code> file * <li>use fallback classname * </ol> * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object