Java Code Examples for org.jets3t.service.model.S3Object#getMetadata()

The following examples show how to use org.jets3t.service.model.S3Object#getMetadata() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Jets3tFileSystemStore.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void checkMetadata(S3Object object) throws S3FileSystemException,
    S3ServiceException {
  
  String name = (String) object.getMetadata(FILE_SYSTEM_NAME);
  if (!FILE_SYSTEM_VALUE.equals(name)) {
    throw new S3FileSystemException("Not a Hadoop S3 file.");
  }
  String type = (String) object.getMetadata(FILE_SYSTEM_TYPE_NAME);
  if (!FILE_SYSTEM_TYPE_VALUE.equals(type)) {
    throw new S3FileSystemException("Not a block file.");
  }
  String dataVersion = (String) object.getMetadata(FILE_SYSTEM_VERSION_NAME);
  if (!FILE_SYSTEM_VERSION_VALUE.equals(dataVersion)) {
    throw new VersionMismatchException(FILE_SYSTEM_VERSION_VALUE,
        dataVersion);
  }
}
 
Example 2
Source File: Jets3tFileSystemStore.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void checkMetadata(S3Object object) throws S3FileSystemException,
    S3ServiceException {
  
  String name = (String) object.getMetadata(FILE_SYSTEM_NAME);
  if (!FILE_SYSTEM_VALUE.equals(name)) {
    throw new S3FileSystemException("Not a Hadoop S3 file.");
  }
  String type = (String) object.getMetadata(FILE_SYSTEM_TYPE_NAME);
  if (!FILE_SYSTEM_TYPE_VALUE.equals(type)) {
    throw new S3FileSystemException("Not a block file.");
  }
  String dataVersion = (String) object.getMetadata(FILE_SYSTEM_VERSION_NAME);
  if (!FILE_SYSTEM_VERSION_VALUE.equals(dataVersion)) {
    throw new VersionMismatchException(FILE_SYSTEM_VERSION_VALUE,
        dataVersion);
  }
}
 
Example 3
Source File: Jets3tFileSystemStore.java    From RDFS with Apache License 2.0 6 votes vote down vote up
private void checkMetadata(S3Object object) throws S3FileSystemException,
    S3ServiceException {
  
  String name = (String) object.getMetadata(FILE_SYSTEM_NAME);
  if (!FILE_SYSTEM_VALUE.equals(name)) {
    throw new S3FileSystemException("Not a Hadoop S3 file.");
  }
  String type = (String) object.getMetadata(FILE_SYSTEM_TYPE_NAME);
  if (!FILE_SYSTEM_TYPE_VALUE.equals(type)) {
    throw new S3FileSystemException("Not a block file.");
  }
  String dataVersion = (String) object.getMetadata(FILE_SYSTEM_VERSION_NAME);
  if (!FILE_SYSTEM_VERSION_VALUE.equals(dataVersion)) {
    throw new VersionMismatchException(FILE_SYSTEM_VERSION_VALUE,
        dataVersion);
  }
}
 
Example 4
Source File: Jets3tFileSystemStore.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
private void checkMetadata(S3Object object) throws S3FileSystemException,
    S3ServiceException {
  
  String name = (String) object.getMetadata(FILE_SYSTEM_NAME);
  if (!FILE_SYSTEM_VALUE.equals(name)) {
    throw new S3FileSystemException("Not a Hadoop S3 file.");
  }
  String type = (String) object.getMetadata(FILE_SYSTEM_TYPE_NAME);
  if (!FILE_SYSTEM_TYPE_VALUE.equals(type)) {
    throw new S3FileSystemException("Not a block file.");
  }
  String dataVersion = (String) object.getMetadata(FILE_SYSTEM_VERSION_NAME);
  if (!FILE_SYSTEM_VERSION_VALUE.equals(dataVersion)) {
    throw new VersionMismatchException(FILE_SYSTEM_VERSION_VALUE,
        dataVersion);
  }
}
 
Example 5
Source File: MigrationTool.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public int run(String[] args) throws Exception {
  
  if (args.length == 0) {
    System.err.println("Usage: MigrationTool <S3 file system URI>");
    System.err.println("\t<S3 file system URI>\tfilesystem to migrate");
    ToolRunner.printGenericCommandUsage(System.err);
    return -1;
  }
  
  URI uri = URI.create(args[0]);
  
  initialize(uri);
  
  FileSystemStore newStore = new Jets3tFileSystemStore();
  newStore.initialize(uri, getConf());
  
  if (get("%2F") != null) { 
    System.err.println("Current version number is [unversioned].");
    System.err.println("Target version number is " +
        newStore.getVersion() + ".");
    Store oldStore = new UnversionedStore();
    migrate(oldStore, newStore);
    return 0;
  } else {
    S3Object root = get("/");
    if (root != null) {
      String version = (String) root.getMetadata("fs-version");
      if (version == null) {
        System.err.println("Can't detect version - exiting.");
      } else {
        String newVersion = newStore.getVersion();
        System.err.println("Current version number is " + version + ".");
        System.err.println("Target version number is " + newVersion + ".");
        if (version.equals(newStore.getVersion())) {
          System.err.println("No migration required.");
          return 0;
        }
        // use version number to create Store
        //Store oldStore = ... 
        //migrate(oldStore, newStore);
        System.err.println("Not currently implemented.");
        return 0;
      }
    }
    System.err.println("Can't detect version - exiting.");
    return 0;
  }
  
}
 
Example 6
Source File: MigrationTool.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public int run(String[] args) throws Exception {
  
  if (args.length == 0) {
    System.err.println("Usage: MigrationTool <S3 file system URI>");
    System.err.println("\t<S3 file system URI>\tfilesystem to migrate");
    ToolRunner.printGenericCommandUsage(System.err);
    return -1;
  }
  
  URI uri = URI.create(args[0]);
  
  initialize(uri);
  
  FileSystemStore newStore = new Jets3tFileSystemStore();
  newStore.initialize(uri, getConf());
  
  if (get("%2F") != null) { 
    System.err.println("Current version number is [unversioned].");
    System.err.println("Target version number is " +
        newStore.getVersion() + ".");
    Store oldStore = new UnversionedStore();
    migrate(oldStore, newStore);
    return 0;
  } else {
    S3Object root = get("/");
    if (root != null) {
      String version = (String) root.getMetadata("fs-version");
      if (version == null) {
        System.err.println("Can't detect version - exiting.");
      } else {
        String newVersion = newStore.getVersion();
        System.err.println("Current version number is " + version + ".");
        System.err.println("Target version number is " + newVersion + ".");
        if (version.equals(newStore.getVersion())) {
          System.err.println("No migration required.");
          return 0;
        }
        // use version number to create Store
        //Store oldStore = ... 
        //migrate(oldStore, newStore);
        System.err.println("Not currently implemented.");
        return 0;
      }
    }
    System.err.println("Can't detect version - exiting.");
    return 0;
  }
  
}
 
Example 7
Source File: MigrationTool.java    From RDFS with Apache License 2.0 4 votes vote down vote up
public int run(String[] args) throws Exception {
  
  if (args.length == 0) {
    System.err.println("Usage: MigrationTool <S3 file system URI>");
    System.err.println("\t<S3 file system URI>\tfilesystem to migrate");
    ToolRunner.printGenericCommandUsage(System.err);
    return -1;
  }
  
  URI uri = URI.create(args[0]);
  
  initialize(uri);
  
  FileSystemStore newStore = new Jets3tFileSystemStore();
  newStore.initialize(uri, getConf());
  
  if (get("%2F") != null) { 
    System.err.println("Current version number is [unversioned].");
    System.err.println("Target version number is " +
        newStore.getVersion() + ".");
    Store oldStore = new UnversionedStore();
    migrate(oldStore, newStore);
    return 0;
  } else {
    S3Object root = get("/");
    if (root != null) {
      String version = (String) root.getMetadata("fs-version");
      if (version == null) {
        System.err.println("Can't detect version - exiting.");
      } else {
        String newVersion = newStore.getVersion();
        System.err.println("Current version number is " + version + ".");
        System.err.println("Target version number is " + newVersion + ".");
        if (version.equals(newStore.getVersion())) {
          System.err.println("No migration required.");
          return 0;
        }
        // use version number to create Store
        //Store oldStore = ... 
        //migrate(oldStore, newStore);
        System.err.println("Not currently implemented.");
        return 0;
      }
    }
    System.err.println("Can't detect version - exiting.");
    return 0;
  }
  
}
 
Example 8
Source File: MigrationTool.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
public int run(String[] args) throws Exception {
  
  if (args.length == 0) {
    System.err.println("Usage: MigrationTool <S3 file system URI>");
    System.err.println("\t<S3 file system URI>\tfilesystem to migrate");
    ToolRunner.printGenericCommandUsage(System.err);
    return -1;
  }
  
  URI uri = URI.create(args[0]);
  
  initialize(uri);
  
  FileSystemStore newStore = new Jets3tFileSystemStore();
  newStore.initialize(uri, getConf());
  
  if (get("%2F") != null) { 
    System.err.println("Current version number is [unversioned].");
    System.err.println("Target version number is " +
        newStore.getVersion() + ".");
    Store oldStore = new UnversionedStore();
    migrate(oldStore, newStore);
    return 0;
  } else {
    S3Object root = get("/");
    if (root != null) {
      String version = (String) root.getMetadata("fs-version");
      if (version == null) {
        System.err.println("Can't detect version - exiting.");
      } else {
        String newVersion = newStore.getVersion();
        System.err.println("Current version number is " + version + ".");
        System.err.println("Target version number is " + newVersion + ".");
        if (version.equals(newStore.getVersion())) {
          System.err.println("No migration required.");
          return 0;
        }
        // use version number to create Store
        //Store oldStore = ... 
        //migrate(oldStore, newStore);
        System.err.println("Not currently implemented.");
        return 0;
      }
    }
    System.err.println("Can't detect version - exiting.");
    return 0;
  }
  
}