Package com.cloudloop.storage

Examples of com.cloudloop.storage.CloudStorePath


  CloudStoreObject[ ] children = sendListDirectoryContentsRequest(
                   fromDirectory,
                   CloudStoreObjectType.OBJECT,
                   true );
 
  CloudStorePath newDirPath = toDirectory.getPath( )
    .combine(
        PathUtil.popLeaf( fromDirectory.getPath( ) ) );
 
  CloudStoreObjectMetadata newMetadata = fromDirectory.getMetadata( );
  if ( toDirectory.hasDirtyMetadata( ) )
  {
      // user has written meta-data to the target object,
      // implying that meta-data should be overwritten.
      newMetadata = toDirectory.getDirtyMetadata( );
  }
 
  sendIntraStoreCopyRequest( fromDirectory.getPath( ), newDirPath,
           newMetadata );
  for ( CloudStoreObject child : children )
  {
      CloudStorePath newPath = PathUtil
        .replace( child.getPath( ),
            fromDirectory.getPath( ), newDirPath );
      sendIntraStoreCopyRequest( child.getPath( ), newPath, child
        .getMetadata( ) );
  }
View Full Code Here


  CloudStoreObject[ ] children = sendListDirectoryContentsRequest(
                   directory,
                   CloudStoreObjectType.OBJECT,
                   true );
 
  CloudStorePath newDirPath = directory.getParentDirectory( ).getPath( )
    .combine(
        new CloudStorePath( newName, true,
    PathUtil.ROOT_DIRECTORY ) );
 
  sendIntraStoreCopyRequest( directory.getPath( ), newDirPath, directory
    .getMetadata( ) );
  for ( CloudStoreObject child : children )
  {
      CloudStorePath newPath = PathUtil.replace( child.getPath( ),
                   directory.getPath( ),
                   newDirPath );
      sendIntraStoreCopyRequest( child.getPath( ), newPath, child
        .getMetadata( ) );
  }
View Full Code Here

    {
  // TODO: Change this to a single request once Amazon extends
  // their API to include a rename function.
  sendIntraStoreCopyRequest( file, getFile( file.getParentDirectory( )
    .getPath( ).combine(
             new CloudStorePath( newName, false,
    PathUtil.ROOT_DIRECTORY ) ).getAbsolutePath( ) ) );
 
  sendRemoveFileRequest( file );
    }
View Full Code Here

   
    @Test
    public void testSendIntraStoreCopyRequest( )
    {
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  CloudStorePath dirPath = new CloudStorePath( "/foo/bar/" );
  store.createDirectory( store.getDirectory( "/foo/bar/" ) );
  CloudStoreFile fileToUpload = store.getFile( "/foo/bar/some_file.txt" );
  fileToUpload.setStreamToStore( new MockFileStream( 50 ) );
  fileToUpload.write( null );
  // HACK!! (AL) For some reason, Nirvanix needs time to process the file
  // before it can be copied. I'm not sure why this is, and I can't
  // find anything in the docs.
  // TODO: Perhaps put in a retry for the copy command?
  try
  {
      Thread.sleep( 1000 );
  }
  catch ( Throwable e )
  {
  }
  fileToUpload.copyTo( store
    .getFile( dirPath.getParent( )
    .combine(
        PathUtil.popLeaf( fileToUpload.getPath( ) ) )
    .getAbsolutePath( ) ), null );
  assertTrue( store.contains( store.getFile( "/foo/some_file.txt" ) ) );
    }
View Full Code Here

    CloudStoreObject cloudStoreObject;
    boolean isDir = filesObject.getName( ).endsWith( "/" );
    if ( isDir )
    {
        cloudStoreObject = new CloudStoreDirectory( this,
          new CloudStorePath( filesObject.getName( ) ) );
        if ( recursive )
        {
      cloudStoreObjects
        .addAll( Arrays
          .asList( sendListDirectoryContentsRequest(
                       (CloudStoreDirectory) cloudStoreObject,
                       typeFilter,
                       recursive ) ) );
        }
        if ( typeFilter != CloudStoreObjectType.FILE )
        {
      cloudStoreObject.setMetadata( objectMetadata );
      cloudStoreObjects.add( cloudStoreObject );
        }
    }
    if ( !isDir && typeFilter != CloudStoreObjectType.DIRECTORY )
    {
        cloudStoreObject = new CloudStoreFile( this,
          new CloudStorePath( filesObject.getName( ) ) );
        cloudStoreObject.setMetadata( objectMetadata );
        cloudStoreObjects.add( cloudStoreObject );
    }
      }
  }
View Full Code Here

  CloudStoreObject[ ] children = sendListDirectoryContentsRequest(
                   fromDirectory,
                   CloudStoreObjectType.OBJECT,
                   true );
 
  CloudStorePath newDirPath = toDirectory.getPath( )
    .combine(
        PathUtil.popLeaf( fromDirectory.getPath( ) ) );
  CloudStoreDirectory newDirectory = getDirectory( newDirPath
    .getAbsolutePath( ) );
  if ( !newDirectory.existsInStore( ) )
  {
      sendCreateDirectoryRequest( newDirectory );
  }
 
  for ( CloudStoreObject child : children )
  {
      CloudStorePath newPath = PathUtil
        .replace( child.getPath( ),
            fromDirectory.getPath( ), newDirPath );
      if ( newPath.isDirectory( ) )
      {
    sendIntraStoreCopyRequest( (CloudStoreDirectory) child,
             newDirectory );
      }
      else
      {
    CloudStoreFile newFile = getFile( newPath.getAbsolutePath( ) );
    sendIntraStoreCopyRequest( (CloudStoreFile) child, newFile );
      }
  }
    }
View Full Code Here

  CloudStoreObject[ ] children = sendListDirectoryContentsRequest(
                   directory,
                   CloudStoreObjectType.OBJECT,
                   true );
 
  CloudStorePath newDirPath = directory.getParentDirectory( ).getPath( )
    .combine(
        new CloudStorePath( newName, true,
    PathUtil.ROOT_DIRECTORY ) );
  CloudStoreDirectory newDir = getDirectory( newDirPath.getAbsolutePath( ) );
  sendCreateDirectoryRequest( newDir );
 
  for ( CloudStoreObject child : children )
  {
      CloudStorePath newPath = PathUtil.replace( child.getPath( ),
                   directory.getPath( ),
                   newDirPath );
      if ( newPath.isDirectory( ) )
      {
    sendIntraStoreCopyRequest( (CloudStoreDirectory) child, newDir );
      }
      else
      {
    CloudStoreFile newFile = getFile( newPath.getAbsolutePath( ) );
    sendIntraStoreCopyRequest( (CloudStoreFile) child, newFile );
      }
  }
  sendRemoveDirectoryRequest( directory, true );
    }
View Full Code Here

    @Override
    public void sendRenameFileRequest( CloudStoreFile file, String newName )
    {
  sendIntraStoreCopyRequest( file, getFile( file.getParentDirectory( )
    .getPath( ).combine(
             new CloudStorePath( newName, false,
    PathUtil.ROOT_DIRECTORY ) ).getAbsolutePath( ) ) );
 
  sendRemoveFileRequest( file );
    }
View Full Code Here

  File targetDir =
    new File(
    _pathNormalizer.normalizeToStorePath(
    directory.getParentDirectory( ).getPath( )
    .combine(
        new CloudStorePath( newName, true,
    PathUtil.ROOT_DIRECTORY )
    )
    )
    );
 
View Full Code Here

  File targetFile =
    new File(
    _pathNormalizer.normalizeToStorePath(
    file.getParentDirectory( ).getPath( )
    .combine(
        new CloudStorePath( newName, false,
    PathUtil.ROOT_DIRECTORY )
    )
    )
    );
 
View Full Code Here

TOP

Related Classes of com.cloudloop.storage.CloudStorePath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.