/** * @param optionalSuppliedValue * An optional value which has been supplied explicitly * @param brooklynProperties * The properties map where the persistence path should be looked up if not supplied, * along with finding the brooklyn.base.dir if needed (using file system persistence * with a relative path) * @param optionalObjectStoreLocationSpec * If a location spec is supplied, this will return a container name suitable for use * with the given object store based on brooklyn.persistence.dir; if null this method * will return a full file system path, relative to the brooklyn.base.dir if the * configured brooklyn.persistence.dir is not absolute * @return The container name or full path for where persist state should be kept * @deprecated since 0.7.0 use {@link BrooklynServerPaths#newMainPersistencePathResolver(ManagementContext)} */ @Deprecated public static String resolvePersistencePath(String optionalSuppliedValue, StringConfigMap brooklynProperties, String optionalObjectStoreLocationSpec) { return BrooklynServerPaths.newMainPersistencePathResolver(brooklynProperties).location(optionalObjectStoreLocationSpec).dir(optionalSuppliedValue).resolve(); }
persistenceLocation = brooklynProperties.getConfig(BrooklynServerConfig.PERSISTENCE_LOCATION_SPEC); persistenceDir = BrooklynServerPaths.newMainPersistencePathResolver(brooklynProperties).location(persistenceLocation).dir(persistenceDir).resolve(); objectStore = BrooklynPersistenceUtils.newPersistenceObjectStore(managementContext, persistenceLocation, persistenceDir, persistMode, highAvailabilityMode);
/** Creates a {@link PersistenceObjectStore} for use with a specified set of modes. */ public static PersistenceObjectStore newPersistenceObjectStore(ManagementContext managementContext, String locationSpecString, String locationContainer, PersistMode persistMode, HighAvailabilityMode highAvailabilityMode) { PersistenceObjectStore destinationObjectStore; locationContainer = BrooklynServerPaths.newMainPersistencePathResolver(managementContext).location(locationSpecString).dir(locationContainer).resolve(); LocationSpec<?> locationSpec = Strings.isBlank(locationSpecString) ? LocationSpec.create(LocalhostMachineProvisioningLocation.class) : managementContext.getLocationRegistry().getLocationSpec(locationSpecString).get(); Location location = managementContext.getLocationManager().createLocation(locationSpec .configure(LocalLocationManager.CREATE_UNMANAGED, true)); if (!(location instanceof LocationWithObjectStore)) { throw new IllegalArgumentException("Destination location "+location+" does not offer a persistent store"); } destinationObjectStore = ((LocationWithObjectStore)location).newPersistenceObjectStore(locationContainer); destinationObjectStore.injectManagementContext(managementContext); destinationObjectStore.prepareForSharedUse(persistMode, highAvailabilityMode); return destinationObjectStore; }
@Override public PersistenceBackupPathResolver location(String backupLocationSpec) { super.location(backupLocationSpec); return this; } protected boolean isBackupSameLocation() {
@Override protected void checkPersistenceContainerNameIsDefault() { String expected = BrooklynServerPaths.newMainPersistencePathResolver(BrooklynProperties.Factory.newEmpty()).location(null).dir(null).resolve(); checkPersistenceContainerNameIs(expected); }