Search in sources :

Example 1 with RegionNotFoundException

use of org.apache.geode.admin.RegionNotFoundException in project geode by apache.

the class CacheSnapshotServiceImpl method load.

@Override
public void load(File[] snapshots, SnapshotFormat format, SnapshotOptions<Object, Object> options) throws IOException, ClassNotFoundException {
    for (File f : snapshots) {
        GFSnapshotImporter in = new GFSnapshotImporter(f);
        try {
            byte version = in.getVersion();
            if (version == GFSnapshot.SNAP_VER_1) {
                throw new IOException(LocalizedStrings.Snapshot_UNSUPPORTED_SNAPSHOT_VERSION_0.toLocalizedString(version));
            }
            String regionName = in.getRegionName();
            Region<Object, Object> region = cache.getRegion(regionName);
            if (region == null) {
                throw new RegionNotFoundException(LocalizedStrings.Snapshot_COULD_NOT_FIND_REGION_0_1.toLocalizedString(regionName, f));
            }
            RegionSnapshotService<Object, Object> rs = region.getSnapshotService();
            rs.load(f, format, options);
        } finally {
            in.close();
        }
    }
}
Also used : GFSnapshotImporter(org.apache.geode.internal.cache.snapshot.GFSnapshot.GFSnapshotImporter) RegionNotFoundException(org.apache.geode.admin.RegionNotFoundException) IOException(java.io.IOException) File(java.io.File)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 RegionNotFoundException (org.apache.geode.admin.RegionNotFoundException)1 GFSnapshotImporter (org.apache.geode.internal.cache.snapshot.GFSnapshot.GFSnapshotImporter)1