public PropertyEditor getEditor() {
   if (propertyEditorClass == null) {
     return null;
   }
   return ObjectUtilities.loadAndInstantiate(
       propertyEditorClass, DefaultAttributeMetaData.class, PropertyEditor.class);
 }
コード例 #2
0
 /**
  * Executes an weakly referenced external initializer. The initializer will be loaded using
  * reflection and will be executed once. If the initializing fails with any exception, the module
  * will become unavailable.
  *
  * @param classname the classname of the <code>ModuleInitializer</code> implementation
  * @param context the class-loader context from where to load the module's classes.
  * @throws ModuleInitializeException if an error occured or the initializer could not be found.
  */
 protected void performExternalInitialize(final String classname, final Class context)
     throws ModuleInitializeException {
   try {
     final ModuleInitializer mi =
         ObjectUtilities.loadAndInstantiate(classname, context, ModuleInitializer.class);
     if (mi == null) {
       throw new ModuleInitializeException("Failed to load specified initializer class.");
     }
     mi.performInit();
   } catch (ModuleInitializeException mie) {
     throw mie;
   } catch (Exception e) {
     throw new ModuleInitializeException("Failed to load specified initializer class.", e);
   }
 }
コード例 #3
0
  /**
   * Starts parsing.
   *
   * @param attrs the attributes.
   * @throws SAXException if there is a parsing error.
   */
  protected void startParsing(final Attributes attrs) throws SAXException {
    super.startParsing(attrs);
    namespace = attrs.getValue(getUri(), "namespace"); // NON-NLS
    if (namespace == null) {
      throw new ParseException("Attribute 'namespace' is undefined", getLocator());
    }

    namespacePrefix = attrs.getValue(getUri(), "namespace-prefix"); // NON-NLS
    if (namespacePrefix == null) {
      namespacePrefix = ElementTypeRegistry.getInstance().getNamespacePrefix(namespace);
    }
    mandatory = "true".equals(attrs.getValue(getUri(), "mandatory")); // NON-NLS
    computed = "true".equals(attrs.getValue(getUri(), "computed")); // NON-NLS
    transientFlag = "true".equals(attrs.getValue(getUri(), "transient")); // NON-NLS
    bulk = "true".equals(attrs.getValue(getUri(), "prefer-bulk")); // NON-NLS
    designTimeValue = "true".equals(attrs.getValue(getUri(), "design-time-value")); // NON-NLS

    final String valueTypeText = attrs.getValue(getUri(), "value-type"); // NON-NLS
    if (valueTypeText == null) {
      throw new ParseException("Attribute 'value-type' is undefined", getLocator());
    }
    try {
      final ClassLoader classLoader = ObjectUtilities.getClassLoader(getClass());
      valueType = Class.forName(valueTypeText, false, classLoader);
    } catch (Exception e) {
      throw new ParseException("Attribute 'value-type' is not valid", e, getLocator());
    }

    valueRole = attrs.getValue(getUri(), "value-role"); // NON-NLS
    if (valueRole == null) {
      valueRole = "Value"; // NON-NLS
    }

    propertyEditor = attrs.getValue(getUri(), "propertyEditor"); // NON-NLS

    final String metaDataCoreClass = attrs.getValue(getUri(), "impl"); // NON-NLS
    if (metaDataCoreClass != null) {
      attributeCore =
          ObjectUtilities.loadAndInstantiate(
              metaDataCoreClass, AttributeReadHandler.class, AttributeCore.class);
      if (attributeCore == null) {
        throw new ParseException(
            "Attribute 'impl' references a invalid AttributeCore implementation.", getLocator());
      }
    } else {
      attributeCore = new DefaultAttributeCore();
    }
  }
コード例 #4
0
 public void initialize(final DataFactoryContext dataFactoryContext)
     throws ReportDataFactoryException {
   super.initialize(dataFactoryContext);
   if (backend != null) {
     effectiveBackend = backend;
   } else {
     if (useLocalCall) {
       final String className =
           getConfiguration().getConfigProperty(CdaQueryBackend.class.getName());
       effectiveBackend =
           ObjectUtilities.loadAndInstantiate(
               className, CdaQueryBackend.class, CdaQueryBackend.class);
     }
     if (effectiveBackend == null) {
       effectiveBackend = new HttpQueryBackend();
     }
   }
 }