Package com.cloudloop.client.cli.commands.config

Examples of com.cloudloop.client.cli.commands.config.ConfigurationWorkflowElementOutput


      + "'. Expected instance of '"
      + CloudloopConfig.class.getName( ) + "'." );
      }
  }
 
  ConfigurationWorkflowElementOutput output = new ConfigurationWorkflowElementOutput( );
 
  printEncryptionWarning( writer );
 
  CloudloopConfig config = (CloudloopConfig) input;
  boolean alreadyConfigured = ( config.getEncryption( ) != null );
 
  boolean done = false;
 
  while ( !done )
  {
      if ( !alreadyConfigured )
      {
   
    boolean yOrN = ConfigFrameUtil
      .readYorN(
           "Would you like to use Cloudloop's default encryption configuration?\n"
             + "If you choose this option, a key will be generated for you and your data will "
             + "be encrypted using 128-bit AES encryption. (Y/N)? ",
           writer, reader, error );
    if ( yOrN )
    {
        setupDefaultEncryption( config );
    }
    else
    {
        doManualSetup( writer, reader, error, output );
    }
      }
      else
      {
    doManualSetup( config, writer, reader, error, output );
      }
     
      writer
        .println( "Testing your encryption configuration. This could take a few seconds..." );
      writer.flush( );
      if ( !testEncryption( error ) )
      {
    writer.println( "Encryption configuration test failed." );
    writer.flush( );
    boolean yOrN = ConfigFrameUtil
      .readYorN(
           "Would you like to try a different configuration? (Y/N)  ",
           writer, reader, error );
    if ( !yOrN )
    {
        output.quit( );
    }
    else
    {
        done = false;
        continue;
    }
      }
     
      writer.println( "Encryption configuration succesfully tested." );
      writer.flush( );
      done = true;
  }
 
  if ( !output.goBack( ) && !output.quit( ) )
  {
      Encryption newEncryption = new Encryption( );
      newEncryption.setCipher( _cipher );
      newEncryption.setKeyLength( _keyLen );
      newEncryption.setKeyDirectory( _keyDir.getAbsolutePath( ) );
View Full Code Here


{

  @Override
  public ConfigurationWorkflowElementOutput invoke( ConfigurationWorkflow parent, Object input, PrintWriter writer, BufferedReader reader, PrintWriter error )
  {
    ConfigurationWorkflowElementOutput output = new ConfigurationWorkflowElementOutput();
    output.setOutputObject( AdapterType.STORAGE );
    return output;
//    writer.println("Please choose a provider type to configure:");
//    AdapterType[] providerTypes = AdapterType.values( );
//    List<String> providerTypeList = new ArrayList<String>();
//    for ( AdapterType t : providerTypes )
View Full Code Here

      }
    }
    providerList.add( "[Add new provider.]" );
    MenuItemResponse response =
      ConfigFrameUtil.getMenuSelection( writer, reader, error, providerList );
    ConfigurationWorkflowElementOutput output = new ConfigurationWorkflowElementOutput();
    switch ( response.getResponseType( ) )
    {
      case BACK:
        output.setGoBack( true );
        break;
      case QUIT:
        output.setQuit( true );
        break;
      case VALUE:
        if ( response.getVal( ) - 1 < providerList.size( ) - 1 )
        {
          Store toUpdate = null;
          for ( Store store : currentConfig.getStores( ).getStore() )
          {
            if ( store.getName( ).equals( providerList.get( response.getVal( ) - 1 ) ))
            {
              toUpdate = store;
            }
          }
          output.setOutputObject( toUpdate );
        }
        else
        {
          output.setOutputObject( null );
        }
        break;
      default:
        throw new IllegalStateException("Unknown response type '" + response.getResponseType() + "'.");
    }
View Full Code Here

    if ( !(input instanceof CloudloopConfig) )
    {
      throw new IllegalStateException("Invalid type '" + input.getClass( ).getName( ) + "'. Expected type of '" + CloudloopConfig.class.getName() + "'.");
    }
   
    ConfigurationWorkflowElementOutput output = new ConfigurationWorkflowElementOutput();
    boolean yOrN = ConfigFrameUtil.readYorN( "Would you like to save your changes? ", writer, reader, error );
   
    if ( !yOrN )
    {
      output.setGoBack(true);
      return output;
    }
    else
    {
      CloudloopConfig config = (CloudloopConfig) input;
      if ( !isValidToSave( config, writer, reader, error ) )
      {
        output.setGoBack( true );
        return output;
      }
      File configFile = CliSession.getSession( ).getConfigFile();
      if ( !configFile.getParentFile( ).exists( ) )
      {
View Full Code Here

  @Override
  public ConfigurationWorkflowElementOutput invoke( ConfigurationWorkflow parent, Object input, PrintWriter writer, BufferedReader reader, PrintWriter error )
  {
    CloudloopConfig config = parent.getSession( ).getCurrentConfig( );
   
    ConfigurationWorkflowElementOutput output = new ConfigurationWorkflowElementOutput();
    output.setOutputObject(config);
    if ( input == null )
    {
      setupNewProvider( parent, config, writer, reader, error, output );
    }
    else
View Full Code Here

        return;
      }
      writer.println( );
     
      EncryptionConfigFrame encryptionConfigFrame = new EncryptionConfigFrame();
      ConfigurationWorkflowElementOutput encryptionFrameOutput = encryptionConfigFrame.invoke( parent, config, writer, reader, error );
      output.setQuit( encryptionFrameOutput.quit() );
      output.setGoBack( encryptionFrameOutput.goBack( ) );
      if ( !output.goBack( ) && !output.quit( ) && config.getEncryption( ) != null )
      {
        provider.setEncrypted( true );
      }
    }
View Full Code Here

TOP

Related Classes of com.cloudloop.client.cli.commands.config.ConfigurationWorkflowElementOutput

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.