Example #1
0
  private void applyConfigurationChange(String propName, Object cmName, Object value)
      throws PropertyException {
    rawProps.put(propName, cmName);
    propValues.put(propName, value != null ? value : cmName);

    if (getInstanceName() != null) cm.fireConfChanged(getInstanceName(), propName);

    if (owner != null) owner.newProperties(this);
  }
Example #2
0
  /**
   * @return the owner of this property sheet. In most cases this will be the configurable instance
   *     which was instrumented by this property sheet.
   */
  public synchronized Configurable getOwner() {
    try {

      if (!isInstanciated()) {
        // ensure that all mandatory properties are set before instantiating the component
        Collection<String> undefProps = getUndefinedMandatoryProps();
        if (!undefProps.isEmpty()) {
          throw new InternalConfigurationException(
              getInstanceName(), undefProps.toString(), "not all mandatory properties are defined");
        }

        owner = ownerClass.newInstance();
        owner.newProperties(this);
      }
    } catch (IllegalAccessException e) {
      throw new InternalConfigurationException(
          e, getInstanceName(), null, "Can't access class " + ownerClass);
    } catch (InstantiationException e) {
      throw new InternalConfigurationException(
          e, getInstanceName(), null, "Can't instantiate class " + ownerClass);
    }

    return owner;
  }