コード例 #1
0
 /**
  * Dumps out the persisted mementos that are at the given directory.
  *
  * <p>Binds to the persisted state (as a "hot standby") to load the raw data (as strings), and to
  * write out the entity, location, policy, enricher, feed and catalog-item data.
  *
  * @param dir The directory containing the persisted state
  */
 public static void dumpMementoDir(File dir) {
   LocalManagementContextForTests mgmt =
       new LocalManagementContextForTests(BrooklynProperties.Factory.newEmpty());
   FileBasedObjectStore store = null;
   BrooklynMementoPersisterToObjectStore persister = null;
   try {
     store = new FileBasedObjectStore(dir);
     store.injectManagementContext(mgmt);
     store.prepareForSharedUse(PersistMode.AUTO, HighAvailabilityMode.HOT_STANDBY);
     persister =
         new BrooklynMementoPersisterToObjectStore(
             store, BrooklynProperties.Factory.newEmpty(), RebindTestUtils.class.getClassLoader());
     BrooklynMementoRawData data =
         persister.loadMementoRawData(RebindExceptionHandlerImpl.builder().build());
     List<BrooklynObjectType> types =
         ImmutableList.of(
             BrooklynObjectType.ENTITY,
             BrooklynObjectType.LOCATION,
             BrooklynObjectType.POLICY,
             BrooklynObjectType.ENRICHER,
             BrooklynObjectType.FEED,
             BrooklynObjectType.CATALOG_ITEM);
     for (BrooklynObjectType type : types) {
       LOG.info(type + " (" + data.getObjectsOfType(type).keySet() + "):");
       for (Map.Entry<String, String> entry : data.getObjectsOfType(type).entrySet()) {
         LOG.info("\t" + type + " " + entry.getKey() + ": " + entry.getValue());
       }
     }
   } finally {
     if (persister != null) persister.stop(false);
     if (store != null) store.close();
     mgmt.terminate();
   }
 }
コード例 #2
0
 public static void deleteMementoDir(File f) {
   FileBasedObjectStore.deleteCompletely(f);
 }