/** {@inheritDoc} */
  public void configure(ConfigurationContext context) {
    Assure.notNull("context", context);

    // get all properties describing a service
    Iterable<Pair<String, String>> serviceProperties =
        this._ant4EclipseConfiguration.getAllProperties(PROPERTY_PREFIX);

    // Iterate over all service descriptions found
    for (Pair<String, String> serviceProperty : serviceProperties) {

      // instantiate new service instance
      Object serviceInstance = Utilities.newInstance(serviceProperty.getSecond());

      // register new service
      context.registerService(serviceInstance, serviceProperty.getFirst());
    }
  }
Exemplo n.º 2
0
  /** Loads the configured RoleIdentifiers */
  protected void init() {

    // get all properties that defines a ProjectRoleIdentifier
    Ant4EclipseConfiguration config =
        ServiceRegistryAccess.instance().getService(Ant4EclipseConfiguration.class);
    Iterable<Pair<String, String>> entries = config.getAllProperties(PREFIX_VALIDATOR);

    List<ProjectValidator> validators = new ArrayList<ProjectValidator>();

    // Instantiate all ProjectRoleIdentifiers
    for (Pair<String, String> types : entries) {
      // we're not interested in the key of a project validator. only the classname (value of the
      // entry) is relevant
      ProjectValidator projectvalidator =
          Utilities.newInstance(types.getSecond(), types.getFirst());
      A4ELogging.trace("Register ProjectValidator '%s'", projectvalidator);
      validators.add(projectvalidator);
    }

    this._validators = validators.toArray(new ProjectValidator[validators.size()]);
  }