Package com.cloudloop.generated

Examples of com.cloudloop.generated.CloudloopConfig


      }
    }

    // TODO: This is a bit hokey. We're now coupled to static state
    // on CloudPath!
    CloudloopConfig config = CliSession.getSession( ).getCloudloop( ).getConfig( );

    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


  _rackspaceProps.put( "root-container-name", _rackspaceRoot );
  _localProps.put( "root-directory", _localTestFilesystemRoot );
  FileUtil.mkdir( new File( _localTestFilesystemRoot )
    .getParentFile( ) );
  FileUtil.mkdir( new File( _localTestFilesystemRoot ) );
  CloudloopConfig config =
    buildDefaultConfig( _amazonProperties, _nirvanixProps,
            _rackspaceProps,
            _localProps );
  _cloudloop = new Cloudloop( config );
    }
View Full Code Here

                  Properties amazonProperties,
                  Properties nirvanixProperties,
                  Properties rackspaceProperties,
                  Properties localProperties )
    {
  CloudloopConfig config = new CloudloopConfig( );
  Adapters adapters = new Adapters( );
  config.setAdapters( adapters );
  List<Adapter> adapterList = adapters.getAdapter( );
 
  Adapter s3Adapter = new Adapter( );
  s3Adapter.setImpl( AmazonS3CloudStore.class.getName( ) );
  s3Adapter.setName( "amazonS3" );
  s3Adapter.setType( AdapterType.STORAGE );
  adapterList.add( s3Adapter );
 
  Adapter nirvanixAdapter = new Adapter( );
  nirvanixAdapter.setImpl( NirvanixCloudStore.class.getName( ) );
  nirvanixAdapter.setName( "nirvanix" );
  nirvanixAdapter.setType( AdapterType.STORAGE );
  adapterList.add( nirvanixAdapter );
 
  Adapter rackspaceAdapter = new Adapter( );
  rackspaceAdapter.setImpl( RackspaceCloudStore.class.getName( ) );
  rackspaceAdapter.setName( "rackspace" );
  rackspaceAdapter.setType( AdapterType.STORAGE );
  adapterList.add( rackspaceAdapter );
 
  Adapter localAdapter = new Adapter( );
  localAdapter.setImpl( LocalCloudStore.class.getName( ) );
  localAdapter.setName( "local" );
  localAdapter.setType( AdapterType.STORAGE );
  adapterList.add( localAdapter );
 
  Adapter jcloudsS3Adapter = new Adapter( );
  jcloudsS3Adapter.setImpl( JS3CloudStore.class.getName( ) );
  jcloudsS3Adapter.setName( "jS3" );
  jcloudsS3Adapter.setType( AdapterType.STORAGE );
  adapterList.add( jcloudsS3Adapter );
 
  Stores stores = new Stores( );
  config.setStores( stores );
  List<Store> storeList = stores.getStore( );
 
  Store s3Store = new Store( );
  s3Store.setAdapter( "amazonS3" );
  s3Store.setEncrypted( Boolean.TRUE );
  s3Store.setName( "s3" );
  List<PropertyType> s3Props = s3Store.getProperty( );
  for ( Object propName : amazonProperties.keySet( ) )
  {
      PropertyType prop = new PropertyType( );
      prop.setName( (String) propName );
      prop.setValue( amazonProperties.getProperty( (String) propName ) );
      s3Props.add( prop );
  }
  storeList.add( s3Store );
 
  Store jS3Store = new Store( );
  jS3Store.setAdapter( "jS3" );
  jS3Store.setEncrypted( Boolean.TRUE );
  jS3Store.setName( "s3" );
  List<PropertyType> jS3Props = jS3Store.getProperty( );
  for ( Object propName : amazonProperties.keySet( ) )
  {
      PropertyType prop = new PropertyType( );
      prop.setName( (String) propName );
      prop.setValue( amazonProperties.getProperty( (String) propName ) );
      jS3Props.add( prop );
  }
  storeList.add( jS3Store );
 
  Store nirvanixStore = new Store( );
  nirvanixStore.setAdapter( "nirvanix" );
  nirvanixStore.setEncrypted( Boolean.TRUE );
  nirvanixStore.setName( "nirvanix" );
  List<PropertyType> nirvanixProps = nirvanixStore.getProperty( );
  for ( Object propName : nirvanixProperties.keySet( ) )
  {
      PropertyType prop = new PropertyType( );
      prop.setName( (String) propName );
      prop.setValue( nirvanixProperties.getProperty( (String) propName ) );
      nirvanixProps.add( prop );
  }
  storeList.add( nirvanixStore );
 
  Store rackspaceStore = new Store( );
  rackspaceStore.setAdapter( "rackspace" );
  rackspaceStore.setEncrypted( Boolean.TRUE );
  rackspaceStore.setName( "rackspace" );
  List<PropertyType> rackspaceProps = rackspaceStore.getProperty( );
  for ( Object propName : rackspaceProperties.keySet( ) )
  {
      PropertyType prop = new PropertyType( );
      prop.setName( (String) propName );
      prop
        .setValue( rackspaceProperties
        .getProperty( (String) propName ) );
      rackspaceProps.add( prop );
  }
  storeList.add( rackspaceStore );
 
  Store localStore = new Store( );
  localStore.setAdapter( "local" );
  localStore.setEncrypted( Boolean.FALSE );
  localStore.setName( "local" );
  List<PropertyType> localProps = localStore.getProperty( );
  PropertyType localRoot = new PropertyType( );
  for ( Object propName : localProperties.keySet( ) )
  {
      PropertyType prop = new PropertyType( );
      prop.setName( (String) propName );
      prop.setValue( localProperties.getProperty( (String) propName ) );
      localProps.add( prop );
  }
  localProps.add( localRoot );
  storeList.add( localStore );
 
  Encryption encryption = new Encryption( );
  encryption.setCipher( EncryptionUtil.DEFAULT_CIPHER );
  File currDir = new File( "./test-keys/" );
  FileUtil.mkdir( currDir );
  encryption.setKeyDirectory( currDir.getAbsolutePath( ) );
  encryption.setKeyLength( 128 );
  File keyFile = new File( currDir, TimeUtil.getConciseTimestamp( )
    + ".key" );
  EncryptionUtil
    .generateKey( EncryptionUtil.DEFAULT_CIPHER, 128, keyFile );
  encryption.setPreferredKey( keyFile.getName( ) );
  config.setEncryption( encryption );
 
  return config;
    }
View Full Code Here

      return getCloudloop().getConfig( );
  }

  public void setCloudloop( Cloudloop cloudloop )
  {
    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

  protected CloudProvider _provider;


  public CloudPath( String path , Cloudloop cloudloop )
  {
    CloudloopConfig config = cloudloop.getConfig( );
    if (config == null)
    {
      throw new IllegalStateException( "Configuration is null." );
    }
    if (config.getStores( ) == null
        || config.getStores( ).getStore( ).size( ) == 0)
    {
      throw new IllegalStateException( "No providers configured." );
    }
    String defaultProviderName = cloudloop.getConfig( ).getStores( )
        .getDefaultStore( );
View Full Code Here

     */
    public static Cloudloop loadFrom( File configFile )
      throws  CouldNotFindConfigFileException,
          ErrorParsingConfigurationException
    {
      CloudloopConfig loadedConfig = CloudloopConfigLoader.loadFrom( configFile );
    return new Cloudloop( loadedConfig );
    }
View Full Code Here

    {
      InputStream stream = new FileInputStream(file);
        JAXBContext jc = JAXBContext.newInstance( CloudloopConfig.class );
        Unmarshaller um = jc.createUnmarshaller( );
        um.setSchema( schema );
        CloudloopConfig loadedConfig = (CloudloopConfig) um
          .unmarshal( stream );
        stream.close( );
        return loadedConfig;
    }
    // ... a bit annoying that we don't get a more specific exception
View Full Code Here

 
  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( ) );
      newEncryption.setPreferredKey( _preferredKey.getName( ) );
      config.setEncryption( newEncryption );
  }
 
  return output;
    }
View Full Code Here

    }
   
    writer.println("Please choose a provider to configure:");

    List<String> providerList = new ArrayList<String>();
    CloudloopConfig currentConfig = parent.getSession( ).getCurrentConfig( );
    ProviderFactory factory = parent.getSession( ).getProviderFactory( );
    if ( currentConfig == null )
    {
      currentConfig = new CloudloopConfig();
      parent.getSession( ).setCurrentConfig( currentConfig );
    }
   
    if ( currentConfig != null && currentConfig != null && currentConfig.getStores( ) != null && currentConfig.getStores( ).getStore( ) != null )
    {
      for ( Store store : currentConfig.getStores( ).getStore() )
      {
        providerList.add( store.getName( ) );
      }
    }
    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;
            }
View Full Code Here

      output.setGoBack(true);
      return output;
    }
    else
    {
      CloudloopConfig config = (CloudloopConfig) input;
      if ( !isValidToSave( config, writer, reader, error ) )
      {
        output.setGoBack( true );
        return output;
      }
View Full Code Here

TOP

Related Classes of com.cloudloop.generated.CloudloopConfig

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.