Beispiel #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 JSR330 semantics.
     *
     * @param qualifier always null, removed in refactored eclipse codebase; do not rely on it
     */
    @Override
    @SuppressWarnings({"rawtypes", "unchecked"})
    public void hear(
        final @Deprecated Annotation qualifier,
        final Class<?> implementation,
        final Object source) {
      Class role = getRepositoryRole(implementation);
      if (role != null) {
        String hint = getRepositoryHint(implementation);

        // short-circuit the usual JSR330 binding to just use role+hint
        binder.bind(Key.get(role, Names.named(hint))).to(implementation);

        addRepositoryTypeDescriptor(role, hint);
      } else {
        delegate.hear(qualifier, implementation, source);
      }
    }
    /** 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);
    }
Beispiel #4
0
 public void hear(final Annotation qualifier, final Class<?> qualifiedType, final Object source) {
   plexusTypeBinder.hear(qualifier, qualifiedType, source);
 }