@Override
  public void postInitModule() throws ModuleInitializationException {
    // get connectionPool from ConnectionPoolManager
    ConnectionPoolManager cpm =
        (ConnectionPoolManager)
            getServer().getModule("org.fcrepo.server.storage.ConnectionPoolManager");
    if (cpm == null) {
      throw new ModuleInitializationException(
          "ConnectionPoolManager module was required, but apparently has " + "not been loaded.",
          getRole());
    }
    try {
      this.connectionPool = cpm.getPool();
    } catch (ConnectionPoolNotFoundException e1) {
      throw new ModuleInitializationException(
          "Could not find requested " + "connectionPool.", getRole());
    }

    try {
      irodsFileSystem = IRODSFileSystem.instance();
      JargonProperties origProps = irodsFileSystem.getIrodsSession().getJargonProperties();
      SettableJargonProperties overrideJargonProperties = new SettableJargonProperties(origProps);
      overrideJargonProperties.setIrodsSocketTimeout(irodsSocketTimeout); // was 300
      overrideJargonProperties.setIrodsParallelSocketTimeout(irodsSocketTimeout); // was 300
      irodsFileSystem.getIrodsSession().setJargonProperties(overrideJargonProperties);
    } catch (JargonException e) {
      throw new ModuleInitializationException(
          "Could not create IRODSFileSystem: " + e.getLocalizedMessage(), getRole());
    }
    objectStore = makeStore(objectStoreBase, OBJECT_REGISTRY_TABLE);
    datastreamStore = makeStore(datastreamStoreBase, DATASTREAM_REGISTRY_TABLE);
  }
Пример #2
0
  @Test
  public void testHandleNoObjStatUnderRootOrHomeByLookingForPublicAndHome() throws Exception {
    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    SettableJargonProperties props =
        new SettableJargonProperties(irodsFileSystem.getJargonProperties());
    props.setDefaultToPublicIfNothingUnderRootWhenListing(true);
    irodsFileSystem.getIrodsSession().setJargonProperties(props);

    CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO =
        irodsFileSystem
            .getIRODSAccessObjectFactory()
            .getCollectionAndDataObjectListAndSearchAO(irodsAccount);
    CollectionListingUtils listingUtils =
        new CollectionListingUtils(collectionAndDataObjectListAndSearchAO);

    String path = "/";
    ObjStat objStat = listingUtils.handleNoObjStatUnderRootOrHomeByLookingForPublicAndHome(path);
    Assert.assertNotNull(objStat);
    Assert.assertTrue(objStat.isStandInGeneratedObjStat());
    Assert.assertEquals(path, objStat.getAbsolutePath());
  }