Package com.cloudloop

Examples of com.cloudloop.CloudPath


      CommandLineArguments args )
  {
    assertCorrectNumberOfArgs( args, 1 );
    assertConfigurationInitialized( );

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

    List<CloudStoreFile> files = new ArrayList<CloudStoreFile>( );

    for (String arg : args.getArguments())
    {
      CloudPath filePath = new CloudPath( arg , currentDir, CliSession.getSession( ).getCloudloop( ) );
      CloudStore store = (CloudStore) filePath.getCloudProvider( );
      CloudStoreFile file = store.getFile( filePath.getPath( ) );
      if (!file.existsInStore( ))
      {
        err.println( "File '" + filePath.getPath( )
            + "' does not exist in store '"
            + store.getCloudloopToken( ) + "'." );
        return 1;
      }
      files.add( file );
View Full Code Here


    if (subCommand.equals( LOAD_COMMAND ))
    {
      Cloudloop cloudloop = Cloudloop.loadFrom( configFile );
      CliSession.getSession( ).setCloudloop( cloudloop );
      CliSession.getSession( ).setCurrentDirectory(
          new CloudPath( "//" + config.getStores( ).getDefaultStore( )
              + "/", CliSession.getSession( ).getCloudloop( ) ) );
    } else if (subCommand.equals( SETUP_COMMAND ))
    {
      runSetupWizard( out, in, err );
    } else if (subCommand.equals( PRINT_COMMAND ))
View Full Code Here

      CommandLineArguments args )
  {
    assertCorrectNumberOfArgs( args, 0, 2 );
    assertConfigurationInitialized( );

    CloudPath path = CliSession.getSession( ).getCurrentDirectory( );
    boolean recursive = false;

    boolean pathInitialized = false;
        if (args.hasFlag("recursive"))
        {
            recursive=true;
        }
    for (String arg : args.getArguments())
    {
        if (pathInitialized)
        {
          err.println( "Cannot specify more than one path argument." );
          err.println( "Usage:" );
          err.println( getUsage( ) );
        }
        path = new CloudPath( arg , path , CliSession.getSession( )
            .getCloudloop( ) );
        pathInitialized = true;
    }

    CloudStore cloudStore = (CloudStore) path.getCloudProvider( );
    CloudStoreDirectory cloudStoreDirectory = cloudStore.getDirectory( path
        .getPath( ) );
    CloudStoreObject[] cloudStoreObjects = cloudStoreDirectory
        .listContents( recursive );

    for (CloudStoreObject cloudStoreObject : cloudStoreObjects)
View Full Code Here

      CommandLineArguments args )
  {
    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 );
View Full Code Here

      CommandLineArguments args )
  {
    assertCorrectNumberOfArgs( args, 1, 1 );
    assertConfigurationInitialized( );

    CloudPath path = new CloudPath( args.getArguments().get( 0 ) , CliSession.getSession( )
        .getCurrentDirectory( ) , CliSession.getSession( )
        .getCloudloop( ) );

    CloudStore cloudStore = (CloudStore) path.getCloudProvider( );
    cloudStore.createDirectory( cloudStore.getDirectory( path.getPath( ) ) );

    return 0;
  }
View Full Code Here

           CommandLineArguments args )
    {
    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 );
View Full Code Here

    CloudloopConfig config = cloudloop.getConfig( );
    if ( config == null || config.getStores( ) == null || config.getStores( ).getStore( ).size( ) == 0 )
    {
      throw new IllegalStateException("No stores configured.");
    }
    setCurrentDirectory( new CloudPath("/", cloudloop) );
    getSession().setSessionValue( SESSION_KEY_CLOUDLOOP, cloudloop );
  }
View Full Code Here

      CommandLineArguments args )
  {
    assertCorrectNumberOfArgs( args, 0, 1 );
    assertConfigurationInitialized( );

    CloudPath currentDir = CliSession.getSession( ).getCurrentDirectory( );
    if (args.size( ) == 0)
    {
      // just print pwd and exit
      out.println( currentDir.getRawURI( ) );
      return 0;
    }

    String path = args.getArguments().get( 0 ).replace( '\\', '/' );
    if (!path.endsWith( "/" ))
    {
      path += "/";
    }
    CloudPath newDir = new CloudPath( path , currentDir, CliSession.getSession( ).getCloudloop( ) );

    CloudStore cloudStore = (CloudStore) newDir.getCloudProvider( );

    if (!cloudStore.getDirectory( newDir.getPath( ) ).existsInStore( ))
    {
      err.println( "Directory '" + newDir + "' does not exist in store '"
          + cloudStore.getCloudloopToken( ) + "'." );
      return 1;
    }
View Full Code Here

      CommandLineArguments args )
  {
    assertCorrectNumberOfArgs( args, 1, 2 );
    assertConfigurationInitialized( );

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

    boolean recursive = args.hasFlag( "recursive" );
    String pathArg = null;
    if (args.getArguments( ).size( ) > 0)
    {
      pathArg = args.getArguments( ).get( 0 );
    }

    if (pathArg == null)
    {
      err.println( "Must provide a path argument." );
      return 1;
    }

    CloudPath path = new CloudPath( pathArg , currentDir, CliSession.getSession( ).getCloudloop( ) );
    CloudStore cloudStore = (CloudStore) path.getCloudProvider( );

    cloudStore.removeDirectory( cloudStore.getDirectory( path.getPath( ) ),
        recursive );

    return 0;
  }
View Full Code Here

      CommandLineArguments args )
  {
    assertCorrectNumberOfArgs( args, 1, 1 );
    assertConfigurationInitialized( );

    CloudPath currentDir = CliSession.getSession( ).getCurrentDirectory( );
    CloudPath path = new CloudPath( args.getArguments().get( 0 ) , currentDir, CliSession.getSession( ).getCloudloop( ) );

    CloudStore cloudStore = (CloudStore) path.getCloudProvider( );
    cloudStore.removeFile( cloudStore.getFile( path.getPath( ) ) );

    return 0;
  }
View Full Code Here

TOP

Related Classes of com.cloudloop.CloudPath

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.