Package org.picocontainer

Examples of org.picocontainer.PicoCompositionException


        }
        return provideMethod;
    }

    private static PicoCompositionException newProviderMethodException(String str) {
        return new PicoCompositionException("There must be "+ str +" method named 'provide' in the AbstractProvider implementation");
    }
View Full Code Here


                Object value = decorator.decorate(instance);
                field.setAccessible(true);
                try {
                    field.set(instance, value);
                } catch (IllegalAccessException e) {
                    throw new PicoCompositionException(e);
                }
            }
        }
        return instance;
    }
View Full Code Here

                if (null == registeredObjectNames) {
                    registeredObjectNames = new ArrayList<ObjectName>();
                }
                registeredObjectNames.add(info.getObjectName());
                if (exception != null) {
                    throw new PicoCompositionException("Registering MBean failed", exception);
                }
            }
        }
        return componentInstance;
    }
View Full Code Here

        this.proxyFactory = proxyFactory;
        final Class<T> delegationType = delegate.getComponentImplementation();
        this.isCompatible = type.isAssignableFrom(delegationType);
        if (!isCompatible) {
            if (!proxyFactory.canProxy(type)) {
                throw new PicoCompositionException("Cannot create proxy for type " + type.getName());
            }
            final Method[] methods = type.getMethods();
            for (final Method method : methods) {
                try {
                    delegationType.getMethod(method.getName(), method.getParameterTypes());
                } catch (final NoSuchMethodException e) {
                    throw new PicoCompositionException("Cannot create proxy for type "
                                                         + type.getName()
                                                         + ", because of incompatible method "
                                                         + method.toString());
                }
            }
View Full Code Here

        } else {
            final Set allInterfaces = ReflectionUtils.getAllInterfaces(getComponentImplementation());
            interfaces = (Class[])allInterfaces.toArray(new Class[allInterfaces.size()]);
        }
        if (interfaces.length == 0) {
            throw new PicoCompositionException("Can't proxy implementation for "
                    + getComponentImplementation().getName()
                    + ". It does not implement any interfaces.");
        }
        return interfaces;
    }
View Full Code Here

    } catch(NameNotFoundException e) {
      // this is not error, but normal situation - nothing
      // was stored yet
      return null;
    } catch (NamingException e) {
      throw new PicoCompositionException("unable to resolve jndi name:"
          + name, e);
    }
  }
View Full Code Here

          // that's ok
        }
        ctx.bind(n, item);
      }
    } catch (NamingException e) {
      throw new PicoCompositionException("unable to bind to  jndi name:"
          + name, e);
    }
  }
View Full Code Here

  public T getComponentInstance(final PicoContainer container, final Type into)
      throws PicoCompositionException {
    try {
      return (T) factoryMethod.invoke(targetInstance);
    } catch (RuntimeException e) {
      throw new PicoCompositionException(
          "Error invoking delegate for object construction", e);
    }
  }
View Full Code Here

    try {
      return new JNDIExposed<T>(super.addComponentAdapter(
          componentMonitor, lifecycleStrategy, componentProperties,
          adapter));
    } catch (NamingException e) {
      throw new PicoCompositionException(
          "unable to create JNDI behaviour", e);
    }
  }
View Full Code Here

        componentKey, componentImplementation, parameters);

    try {
      return new JNDIExposed<T>(componentAdapter);
    } catch (NamingException e) {
      throw new PicoCompositionException(
          "unable to create JNDI behaviour", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.picocontainer.PicoCompositionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.