public synchronized void validate(IConfigurableResourceContext cxt)
      throws OpenConfigurationException {
    if (grammarFactory != null) {
      grammarFactory.validate(cxt);
    } else if (parent == null) {
      throw new OpenConfigurationException("Grammar class is not set", getUri(), null);
    }

    if (binderFactory != null) {
      binderFactory.validate(cxt);
    } else if (parent == null) {
      throw new OpenConfigurationException("Bindings are not set", getUri(), null);
    }

    // Methods and casts are optional
    // else if (parent == null)
    // throw new OpenConfigurationException("Methods are not set", getUri(),
    // null);

    if (methodFactory != null) {
      methodFactory.validate(cxt);
    }

    if (typeCastFactory != null) {
      typeCastFactory.validate(cxt);
    }

    if (typeFactory != null) {
      typeFactory.validate(cxt);
    }

    if (openFactories != null) {
      for (Iterator<IOpenFactoryConfiguration> iter = openFactories.values().iterator();
          iter.hasNext(); ) {
        IOpenFactoryConfiguration factory = iter.next();
        factory.validate(cxt);
      }
    }
  }
  public synchronized void addOpenFactory(IOpenFactoryConfiguration opfc)
      throws OpenConfigurationException {
    if (openFactories == null) {
      openFactories = new HashMap<String, IOpenFactoryConfiguration>();
    }

    if (opfc.getName() == null) {
      throw new OpenConfigurationException("The factory must have a name", opfc.getUri(), null);
    }
    if (openFactories.containsKey(opfc.getName())) {
      throw new OpenConfigurationException(
          "Duplicated name: " + opfc.getName(), opfc.getUri(), null);
    }

    openFactories.put(opfc.getName(), opfc);
  }