Package com.cloudloop.storage.exceptions

Examples of com.cloudloop.storage.exceptions.InvalidPathException


                 String storePath,
                 boolean directory )
    {
  if ( !storePath.startsWith( _root.getAbsolutePath( ) ) )
  {
      throw new InvalidPathException(
        "Local cloud store path '"
          + storePath
          + "' appears to be invalid because it does not begin with the local root directory, '"
          + _root + "'." );
  }
View Full Code Here


     */
    public CloudStorePath combine( CloudStorePath pathToCombine )
    {
  if ( !isDirectory( ) )
  {
      throw new InvalidPathException(
        "Cannot combine " + getAbsolutePath( ) + " with " +
        pathToCombine.getAbsolutePath( ) +
        " because the base path is a file." );
  }
 
View Full Code Here

        .getDefaultStore( );
    CloudProvider defaultProvider = cloudloop
        .getProvider( defaultProviderName );
    if (defaultProvider == null)
    {
      throw new InvalidPathException(
          "Default provider 'null' is not valid." );
    }

    // normalize to *nix path convention
    path = path.replace( '\\', '/' );

    try
    {
      _underlying = new URI( path , false );
      _underlying.normalize( );
      if (_underlying.getAuthority( ) == null)
      {
        _provider = defaultProvider;
        _underlying = new URI( _underlying.getScheme( ) , _underlying
            .getUserinfo( ) , defaultProvider.getCloudloopToken( ) ,
            _underlying.getPort( ) , _underlying.getPath( ) ,
            _underlying.getQuery( ) , _underlying.getFragment( ) );
      } else
      {
        ProviderFactory providerFactory = cloudloop
            .getProviderFactory( );
        String providerToken = _underlying.getAuthority( );
        ProviderConfig providerConfig = CloudloopConfigLoader
            .extractProviderConfig( config, providerToken,
                providerFactory );
        _provider = providerFactory.createProvider( providerConfig );
      }
    } catch (URIException e)
    {
      throw new InvalidPathException( "Error parsing path '" + path
          + "'. " + e.getMessage( ) + "." );
    }
  }
View Full Code Here

    try
    {
      return _underlying.getAuthority( );
    } catch (URIException e)
    {
      throw new InvalidPathException( e );
    }
  }
View Full Code Here

    try
    {
      return _underlying.getFragment( );
    } catch (URIException e)
    {
      throw new InvalidPathException( e );
    }
  }
View Full Code Here

    try
    {
      return _underlying.getHost( );
    } catch (URIException e)
    {
      throw new InvalidPathException( e );
    }
  }
View Full Code Here

        return "/";
      }
      return output;
    } catch (URIException e)
    {
      throw new InvalidPathException( e );
    }
  }
View Full Code Here

    try
    {
      return _underlying.getQuery( );
    } catch (URIException e)
    {
      throw new InvalidPathException( e );
    }
  }
View Full Code Here

    try
    {
      return _underlying.compareTo( new URI( uri.getRawURI( ) , false ) );
    } catch (Exception e)
    {
      throw new InvalidPathException( e );
    }
  }
View Full Code Here

 
  path = path.replace( WINDOWS_PATH_SEPARATOR, PATH_SEPARATOR );
 
  if ( path.matches( ILLEGAL_PATH_CHARACTERS ) )
  {
      throw new InvalidPathException(
        "One or more invalid characters in path " + path + "." );
  }
 
  if ( path.length( ) == 0
    || path.equals( String.valueOf( PATH_SEPARATOR ) ) )
  {
      return ROOT_PATH_STACK;
  }
 
  // validate filename
  if ( !isDirectory )
  {
      if ( !slashInFilePathOkay
        && path.endsWith( String.valueOf( PATH_SEPARATOR ) ) )
      {
    throw new InvalidPathException(
      "Path "
        + path
        + " should represent a file but ends with a path separator character, "
        + PATH_SEPARATOR
        + ", indicating that it is a directory." );
      }
     
      String filename = path;
      if ( path.lastIndexOf( PATH_SEPARATOR ) > 0 )
      {
    filename = path
      .substring( path.lastIndexOf( PATH_SEPARATOR ) + 1 );
      }
     
      // if file is in root directory, then path could start with a slash
      if ( filename.startsWith( String.valueOf( PATH_SEPARATOR ) ) )
      {
    filename = filename.substring( 1 );
      }
     
      if ( filename.matches( ILLEGAL_FILENAME_CHARACTERS ) )
      {
    throw new InvalidPathException( "Path " + path
      + " contains one or more invalid filename characters." );
      }
     
      if ( !slashInFilePathOkay
        && ( filename.contains( "/" ) || filename.contains( "\\" ) ) )
      {
    throw new InvalidPathException( "Path " + path
      + " contains one or more invalid filename characters." );
      }
  }
 
  // If path does not start with a '/', then it is a relative path.
View Full Code Here

TOP

Related Classes of com.cloudloop.storage.exceptions.InvalidPathException

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.