Package com.cloudloop.storage

Examples of com.cloudloop.storage.CloudStoreObject


    }
      }
     
      for ( ListEntry entry : resp.getContents( ) )
      {
    CloudStoreObject obj;
    String path = entry.getKey( );
    if ( !filter.shouldInclude( path ) )
        continue;
    if ( path.endsWith( "/" ) )
    {
        obj = getDirectory( path );
    }
    else
    {
        obj = getFile( path );
    }
    CloudStoreObjectMetadata meta = new CloudStoreObjectMetadata( );
    meta.setContentLengthInBytes( entry.getSize( ) );
    meta.setETag( entry.getETag( ) );
    XMLGregorianCalendar xmlLastMod = entry.getLastModified( );
    meta.setLastModifiedDate( xmlLastMod.toGregorianCalendar( )
      .getTime( ) );
    obj.setMetadata( meta );
    output.add( obj );
      }
     
  }
  return output.toArray( new CloudStoreObject[ output.size( ) ] );
View Full Code Here


    assertCorrectNumberOfArgs( args, 2, 2 );
    assertConfigurationInitialized( );

    CloudPath currentDir = CliSession.getSession( ).getCurrentDirectory( );

    CloudStoreObject fromObj = null;
    CloudStoreObject toObj = null;

    for (String arg : args.getArguments())
    {
      CloudPath path = new CloudPath( arg , currentDir, CliSession.getSession( ).getCloudloop( ) );

      if (fromObj == null)
      {
        boolean preferDirectory = false;
        fromObj = CliUtil.extractObject( path, preferDirectory );
      } else
      {
        boolean preferDirectory = ( fromObj.getStoreObjectType( ) == CloudStoreObjectType.DIRECTORY );
        toObj = CliUtil.extractObject( path, preferDirectory );
      }
    }

    // print copy progress if we're copying across stores
    ProgressPrinter progressPrinter = null;
        assert fromObj != null;
        assert toObj != null;
        if (!fromObj.getParentStore( ).equals( toObj.getParentStore( ) ))
    {
      fromObj.refreshMetadata( );
      progressPrinter = new ProgressPrinter( out );
    }

    if (fromObj.getStoreObjectType( ) == CloudStoreObjectType.DIRECTORY)
    {
      if (toObj.getStoreObjectType( ) != CloudStoreObjectType.DIRECTORY)
      {
        err.println( "Cannot move directory '"
            + fromObj.getPath( ).getAbsolutePath( ) + "' to file '"
            + toObj.getPath( ).getAbsolutePath( ) + "'." );
        return 1;
      }
      ( (CloudStoreDirectory) fromObj ).copyTo(
          (CloudStoreDirectory) toObj, progressPrinter );
    } else
    {
      if (toObj.getStoreObjectType( ) == CloudStoreObjectType.DIRECTORY)
      {
        ( (CloudStoreFile) fromObj ).copyTo(
            (CloudStoreDirectory) toObj, progressPrinter );
      } else
      {
View Full Code Here

      List<FilesObject> filesObjectList = getRootContainer( )
        .getObjects( directory.getPath( ).getAbsolutePath( ) );
      for ( FilesObject filesObject : filesObjectList )
      {
    CloudStoreObjectMetadata objectMetadata = getMetaData( filesObject );
    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 );
    }
      }
  }
  catch ( IOException e )
View Full Code Here

            MockFileSystem.MockDirectory dir,
            CloudStore store )
    {
  for ( MockFileSystem.MockFileSystemObject obj : dir.Children )
  {
      CloudStoreObject cObj;
      String modPath = obj.Path;
      modPath =
        modPath.substring( 0, modPath.lastIndexOf( '/' ) )
        +
        ( obj instanceof MockFileSystem.MockDirectory ? dirPrefix
        : filePrefix ) +
        modPath.substring( modPath.lastIndexOf( '/' ) + 1 );
     
      if ( obj instanceof MockFileSystem.MockFile )
      {
    cObj = store.getFile( modPath );
      }
      else
      {
    cObj = store.getDirectory( modPath );
      }
      assertTrue( store.contains( cObj ) );
      if ( cObj.getStoreObjectType( ) == CloudStoreObjectType.FILE )
      {
    InputStream stream = store.download( store.getFile( cObj
      .getPath( ).getAbsolutePath( ) ), null );
    FileStreamComparer.isStreamEqualToFile( stream,
              new File(
      _testEnvironment.getLocalTestFilesystemRoot( )
      + obj.Path ) );
View Full Code Here

    assertCorrectNumberOfArgs( args, 2, 2 );
    assertConfigurationInitialized( );
   
    CloudPath currentDir = CliSession.getSession( ).getCurrentDirectory( );
   
    CloudStoreObject fromObj = null;
    CloudStoreObject toObj = null;
   
    for ( String arg : args.getArguments() )
    {
        CloudPath path = new CloudPath( arg, currentDir, CliSession.getSession( ).getCloudloop( ) );
       
        if ( fromObj == null )
        {
          boolean preferDirectory = false;
          fromObj = CliUtil.extractObject( path, preferDirectory );
        }
        else
        {
          boolean preferDirectory = ( fromObj.getStoreObjectType( ) == CloudStoreObjectType.DIRECTORY );
          toObj = CliUtil.extractObject( path, preferDirectory );
        }
    }
   
    // print copy progress if we're copying across stores
    ProgressPrinter progressPrinter = null;
        assert fromObj != null;
        assert toObj != null;
        if ( !args.hasFlag("quiet") && !fromObj.getParentStore( ).equals( toObj.getParentStore(   )) )
    {
      fromObj.refreshMetadata( );
      progressPrinter = new ProgressPrinter( out );
    }
   
    if ( fromObj.getStoreObjectType( ) == CloudStoreObjectType.DIRECTORY )
    {
        if ( toObj.getStoreObjectType( ) != CloudStoreObjectType.DIRECTORY )
        {
        err.println( "Cannot copy a directory to a file." );
        return 1;
        }
        CloudStoreDirectory fromDir = (CloudStoreDirectory) fromObj;
        fromDir.copyTo( (CloudStoreDirectory) toObj, progressPrinter );
    }
    else
    {
        if ( toObj.getStoreObjectType( ) == CloudStoreObjectType.DIRECTORY )
        {
        ( (CloudStoreFile) fromObj )
          .copyTo( (CloudStoreDirectory) toObj, progressPrinter );
        }
        else
View Full Code Here

TOP

Related Classes of com.cloudloop.storage.CloudStoreObject

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.