public JDBCMetaBackend(
      DefaultStorageFinder defStoreFind, boolean useConnectionPooling, int maxConnections)
      throws ConfigurationException {
    if (useConnectionPooling && maxConnections <= 0) {
      throw new IllegalArgumentException(
          "If connection pooling is enabled maxConnections shall be a positive integer: "
              + maxConnections);
    }
    // Check whether we want a meta store at all, or whether GS just gave us a dummy
    String metaStoreDisabled = defStoreFind.findEnvVar(DefaultStorageFinder.GWC_METASTORE_DISABLED);
    if (metaStoreDisabled != null && Boolean.parseBoolean(metaStoreDisabled)) {
      enabled = false;
      wrpr = null;
      idCache = null;
    } else {
      try {
        wrpr = new JDBCMBWrapper(defStoreFind, useConnectionPooling, maxConnections);
      } catch (SQLException se) {
        log.error("Failed to start JDBC metastore: " + se.getMessage());
        log.warn("Disabling JDBC metastore, not all functionality will be available!");
        enabled = false;
        wrpr = null;
      }

      if (enabled) {
        idCache = new JDBCMBIdCache(wrpr);
      } else {
        idCache = null;
      }
    }
  }
Esempio n. 2
0
  private File getConfigResource() throws ConfigurationException, FileNotFoundException {
    String cachePath = storageFinder.getDefaultPath();

    File file = new File(cachePath, CONFIGURATION_FILE_NAME);

    return file;
  }
Esempio n. 3
0
 public File getRootCacheDir() throws ConfigurationException {
   return new File(storageFinder.getDefaultPath());
 }