Package com.google.inject

Examples of com.google.inject.ProvisionException


                //Feed the empty properties to get the code work
                JndiBindings.bindInjectorAndBindings(context, injector, new Properties());
            }
            return context;
        } catch (Exception e) {
            throw new ProvisionException("Failed to create JNDI bindings. Reason: " + e, e);
        }
    }
View Full Code Here


        if (routeBuilders != null) {
            for (RoutesBuilder builder : routeBuilders) {
                try {
                    camelContext.addRoutes(builder);
                } catch (Exception e) {
                    throw new ProvisionException("Failed to add the router. Reason: " + e, e);
                }
            }
        }
        updateRegistry(camelContext);       
        return camelContext;
View Full Code Here

                //Feed the empty properties to get the code work
                JndiBindings.bindInjectorAndBindings(context, injector, new Properties());
            }
            return context;
        } catch (Exception e) {
            throw new ProvisionException("Failed to create JNDI bindings. Reason: " + e, e);
        }
    }
View Full Code Here

        if (routeBuilders != null) {
            for (RoutesBuilder builder : routeBuilders) {
                try {
                    camelContext.addRoutes(builder);
                } catch (Exception e) {
                    throw new ProvisionException("Failed to add the router. Reason: " + e, e);
                }
            }
        }
        updateRegistry(camelContext);       
        return camelContext;
View Full Code Here

  private DataSource open() {
    final String dsName = "java:comp/env/jdbc/ReviewDb";
    try {
      return (DataSource) new InitialContext().lookup(dsName);
    } catch (NamingException namingErr) {
      throw new ProvisionException("No DataSource " + dsName, namingErr);
    }
  }
View Full Code Here

    public final Configuration get() {
        try {
            XmlConfigurationReader xmlConfigReader = new XmlConfigurationReader(componentName);
            return new MojoConfiguration(authorUrl, publishUrl, dispatcherUrl, xmlConfigReader);
        } catch (Exception e) {
            throw new ProvisionException("Impossible to provide configuration for component " + componentName, e);
        }
    }
View Full Code Here

    public void schedule( Scheduler scheduler )
        throws Exception
    {
        if ( cronExpression == null && trigger == null )
        {
            throw new ProvisionException( format( "Impossible to schedule Job '%s' without cron expression",
                                                  jobClass.getName() ) );
        }
        if ( cronExpression != null && trigger != null )
        {
          throw new ProvisionException( format( "Impossible to schedule Job '%s' with cron expression " +
                                                "and an associated Trigger at the same time", jobClass.getName() ) );
        }

        JobKey jobKey = jobKey( DEFAULT.equals( jobName ) ? jobClass.getName() : jobName, jobGroup );
        TriggerKey triggerKey = triggerKey( DEFAULT.equals( triggerName ) ? jobClass.getCanonicalName() : triggerName, triggerGroup );
View Full Code Here

            if (context == null) {
                context = new InitialContext();
            }
            return context.lookup(name);
        } catch (NamingException e) {
            throw new ProvisionException("Failed to find name '" + name
                    + "' in JNDI. Cause: " + e, e);
        }
    }
View Full Code Here

                                                                context,
                                                                injector,
                                                                jndiNames);
                                                return context;
                                            } catch (NamingException e) {
                                                throw new ProvisionException(
                                                        "Failed to create JNDI bindings. Reason: "
                                                                + e, e);
                                            }
                                        }
                                    }).in(Scopes.SINGLETON);
View Full Code Here

                    .get(moduleType);

            for (final Method method : configureMethods) {
                int size = method.getParameterTypes().length;
                if (size == 0) {
                    throw new ProvisionException(
                            "No arguments on @Configures method " + method);
                } else if (size > 1) {
                    throw new ProvisionException("Too many arguments " + size
                            + " on @Configures method " + method);
                }
                final Class<?> paramType = getParameterType(type, method, 0);

                bindListener(new AbstractMatcher<TypeLiteral<?>>() {
                    public boolean matches(TypeLiteral<?> typeLiteral) {
                        return typeLiteral.getRawType().equals(paramType);
                    }
                }, new TypeListener() {
                    public <I> void hear(TypeLiteral<I> injectableType,
                            TypeEncounter<I> encounter) {
                        encounter.register(new MembersInjector<I>() {
                            public void injectMembers(I injectee) {
                                // lets invoke the configures method
                                try {
                                    method.setAccessible(true);
                                    method.invoke(moduleInstance, injectee);
                                } catch (IllegalAccessException e) {
                                    throw new ProvisionException(
                                            "Failed to invoke @Configures method "
                                                    + method + ". Reason: " + e,
                                            e);
                                } catch (InvocationTargetException ie) {
                                    Throwable e = ie.getTargetException();
                                    throw new ProvisionException(
                                            "Failed to invoke @Configures method "
                                                    + method + ". Reason: " + e,
                                            e);
                                }
                            }
View Full Code Here

TOP

Related Classes of com.google.inject.ProvisionException

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.