Package com.google.inject

Examples of com.google.inject.ProvisionException


      try {
        final CurrentSchemaVersion sVer = getSchemaVersion(db);
        final int eVer = version.get().getVersionNbr();

        if (sVer == null) {
          throw new ProvisionException("Schema not yet initialized."
              + "  Run init to initialize the schema.");
        }
        if (sVer.versionNbr != eVer) {
          throw new ProvisionException("Unsupported schema version "
              + sVer.versionNbr + "; expected schema version " + eVer
              + ".  Run init to upgrade.");
        }
      } finally {
        db.close();
      }
    } catch (OrmException e) {
      throw new ProvisionException("Cannot read schema_version", e);
    }
  }
View Full Code Here


      @Provides
      IdentifiedUser provideCurrentUser(CurrentUser user) {
        if (user instanceof IdentifiedUser) {
          return (IdentifiedUser) user;
        }
        throw new ProvisionException(NotSignedInException.MESSAGE,
            new NotSignedInException());
      }
    };
  }
View Full Code Here

    if (StringUtils.isEmptyOrNull(url)) {
      return new NoContactStore();
    }

    if (!havePGP()) {
      throw new ProvisionException("BouncyCastle PGP not installed; "
          + " needed to encrypt contact information");
    }

    final URL storeUrl;
    try {
      storeUrl = new URL(url);
    } catch (MalformedURLException e) {
      throw new ProvisionException("Invalid contactstore.url: " + url, e);
    }

    final String storeAPPSEC = config.getString("contactstore", null, "appsec");
    final File pubkey = site.contact_information_pub;
    if (!pubkey.exists()) {
      throw new ProvisionException("PGP public key file \""
          + pubkey.getAbsolutePath() + "\" not found");
    }
    return new EncryptedContactStore(storeUrl, storeAPPSEC, pubkey, schema,
        connFactory);
  }
View Full Code Here

            @Override
            public File get() {
              if (!ready) {
                synchronized (dataDir) {
                  if (!dataDir.exists() && !dataDir.mkdirs()) {
                    throw new ProvisionException(String.format(
                        "Cannot create %s for plugin %s",
                        dataDir.getAbsolutePath(), name));
                  }
                  ready = true;
                }
View Full Code Here

    final String prngName = "SHA1PRNG";
    try {
      prng = SecureRandom.getInstance(prngName);
    } catch (NoSuchAlgorithmException e) {
      throw new ProvisionException("Cannot create " + prngName, e);
    }

    // Run a test encryption to verify the proper algorithms exist in
    // our JVM and we are able to invoke them. This helps to identify
    // a system configuration problem early at startup, rather than a
    // lot later during runtime.
    //
    try {
      encrypt("test", new Date(0), "test".getBytes("UTF-8"));
    } catch (NoSuchProviderException e) {
      throw new ProvisionException("PGP encryption not available", e);
    } catch (PGPException e) {
      throw new ProvisionException("PGP encryption not available", e);
    } catch (IOException e) {
      throw new ProvisionException("PGP encryption not available", e);
    }
  }
View Full Code Here

        return new PGPPublicKeyRingCollection(in);
      } finally {
        in.close();
      }
    } catch (IOException e) {
      throw new ProvisionException("Cannot read " + pub, e);
    } catch (PGPException e) {
      throw new ProvisionException("Cannot read " + pub, e);
    }
  }
View Full Code Here

  public ReviewDb get() {
    final ReviewDb c;
    try {
      c = schema.open();
    } catch (OrmException e) {
      throw new ProvisionException("Cannot open ReviewDb", e);
    }
    try {
      cleanup.get().add(new Runnable() {
        @Override
        public void run() {
View Full Code Here

        }
      } finally {
        db.close();
      }
    } catch (OrmException e) {
      throw new ProvisionException("Cannot query approval categories", e);
    }

    return new ApprovalTypes(Collections.unmodifiableList(types));
  }
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

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.