예제 #1
0
  @SuppressWarnings("unchecked")
  public void hear(final Component component, final DeferredClass<?> clazz, final Object source) {
    plexusTypeBinder.hear(component, clazz, source);
    if (null != repositoryType) {
      descriptors.add(
          new RepositoryTypeDescriptor(
              (Class<? extends Repository>) component.role(),
              component.hint(),
              repositoryType.pathPrefix(),
              repositoryType.repositoryMaxInstanceCount()));

      repositoryType = null;
    }
  }
    /** Adds {@link RepositoryType} semantics on top of Plexus semantics. */
    @Override
    @SuppressWarnings({"rawtypes", "unchecked"})
    public void hear(
        Component component, final DeferredClass<?> implementation, final Object source) {
      Class role = getRepositoryRole(implementation.load());
      if (role != null) {
        if (StringUtils.isBlank(component.hint())) {
          // if someone forgot to set the repository's hint then use the fully-qualified classname
          component =
              new ComponentImpl(
                  component.role(),
                  getRepositoryHint(implementation.load()),
                  component.instantiationStrategy(),
                  component.description());
        }
        addRepositoryTypeDescriptor(role, component.hint());
      }

      log.warn(
          "Found legacy plexus component: {}",
          log.isDebugEnabled() ? implementation : implementation.getName());

      delegate.hear(component, implementation, source);
    }