Package com.cloudloop.storage.internal

Examples of com.cloudloop.storage.internal.CloudStoreObjectMetadata


 
  // Property accessors
 
  public CloudStoreObjectMetadata getMetadata( )
  {
      CloudStoreObjectMetadata output = new CloudStoreObjectMetadata( );
      SimpleDateFormat sdf = new SimpleDateFormat(
        "EEE, dd MMM yyyy HH:mm:ss z", Locale.US );
      // Wed, 01 Mar 2006 12:00:00 GMT
     
      for ( String key : _tags.keySet( ) )
      {
    if ( key.equals( LAST_MODIFIED ) )
    {
        try
        {
      output.setLastModifiedDate( sdf
        .parse( _tags.get( key ) ) );
        }
        catch ( ParseException e )
        {
      throw new CloudStoreException(
        "Error parsing last modified date meta-data response from store '"
          + getCloudloopToken( ) + "'." );
        }
    }
    else if ( key.equals( CONTENT_LENGTH ) )
    {
        output.setContentLengthInBytes( Long.valueOf( _tags
          .get( key ) ) );
    }
    else if ( key.equals( ETAG ) )
    {
        output.setETag( _tags.get( key ) );
    }
    else
    {
        // custom tag
        output.setCustomTag( key.replace( X_AMZ_META, "" ),
           StringUtil
          .unescape( _tags.get( key ) ) );
    }
      }
      return output;
View Full Code Here


  return convertToCloopMetadata( jObj.getMetadata( ) );
    }
   
    private CloudStoreObjectMetadata convertToCloopMetadata( Metadata metadata )
    {
  CloudStoreObjectMetadata output = new CloudStoreObjectMetadata( );
  output.setContentLengthInBytes( metadata.getSize( ) );
  output.setETag( String.valueOf( metadata.getMd5( ) ) );
  output.setLastModifiedDate( metadata.getLastModified( ).toDate( ) );
  for ( String key : metadata.getUserMetadata( ).keySet( ) )
  {
      Collection<String> vals = metadata.getUserMetadata( ).get( key );
      for ( Object val : vals.toArray( ) )
      {
    output.setCustomTag( key, (String) val );
      }
  }
  return output;
    }
View Full Code Here

   
    @Override
    public void sendIntraStoreCopyRequest( CloudStoreFile fromFile,
             CloudStoreFile toFile )
    {
  CloudStoreObjectMetadata newMetadata = fromFile.getMetadata( );
  if ( toFile.hasDirtyMetadata( ) )
  {
      // user has written meta-data to the target object,
      // implying that meta-data should be overwritten.
      newMetadata = toFile.getDirtyMetadata( );
View Full Code Here

 
  CloudStorePath newDirPath = toDirectory.getPath( )
    .combine(
        PathUtil.popLeaf( fromDirectory.getPath( ) ) );
 
  CloudStoreObjectMetadata newMetadata = fromDirectory.getMetadata( );
  if ( toDirectory.hasDirtyMetadata( ) )
  {
      // user has written meta-data to the target object,
      // implying that meta-data should be overwritten.
      newMetadata = toDirectory.getDirtyMetadata( );
View Full Code Here

  sendIntraStoreCopyRequest( obj.getPath( ), obj.getPath( ), metadata );
 
  // do a full refresh of the meta-data in order to be sure we
  // have all updated properties. this will hurt performance a bit,
  // but the user will be assured that they have the right meta-data.
  CloudStoreObjectMetadata newMetadata = sendRefreshMetadataRequest( obj );
  newMetadata.setComplete( );
  obj.setMetadata( newMetadata );
  return newMetadata;
    }
View Full Code Here

    }
    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 );
      }
     
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,
View Full Code Here

  }
    }
   
    private CloudStoreObjectMetadata getMetaData( FilesObjectMetaData raw )
    {
  CloudStoreObjectMetadata objectMetadata = new CloudStoreObjectMetadata( );
  objectMetadata.setContentLengthInBytes( Long.valueOf( raw
    .getContentLength( ) ) );
  try
  {
      objectMetadata.setLastModifiedDate( REMOTE_DATE_FORMAT.get( )
        .parse( raw.getLastModified( ) ) );
  }
  catch ( ParseException e )
  {
      logger.warn( "Cannot parse remote date format, was ["
        + raw.getLastModified( ) + "]" );
  }
  objectMetadata
    .setCustomTags( raw.getMetaData( ) );
  objectMetadata.setETag( raw.getETag( ) );
  for ( Map.Entry<String, String> stringStringEntry : raw.getMetaData( )
    .entrySet( ) )
  {
      objectMetadata.setCustomTag( stringStringEntry.getKey( ),
           stringStringEntry.getValue( ) );
  }
  objectMetadata.setComplete( );
  return objectMetadata;
    }
View Full Code Here

  List<CloudStoreObject> cloudStoreObjects =
    new ArrayList<CloudStoreObject>( );
 
  for ( File child : localDirectory.listFiles( ) )
  {
      CloudStoreObjectMetadata meta = new CloudStoreObjectMetadata( );
      meta.setContentLengthInBytes( child.length( ) );
      meta.setLastModifiedDate( new Date( child.lastModified( ) ) );
      meta.setETag( "n/a" );
      meta.setComplete( );
     
      if ( child.isDirectory( ) )
      {
    CloudStoreDirectory dir =
      getDirectory(
View Full Code Here

 
  File localFile =
    new File( _pathNormalizer
    .normalizeToStorePath( obj.getPath( ) ) );
 
  CloudStoreObjectMetadata output = new CloudStoreObjectMetadata( );
 
  output.setContentLengthInBytes( localFile.length( ) );
 
  output.setLastModifiedDate( new Date( localFile.lastModified( ) ) );
 
  output.setETag( "n/a" );
 
  output.setComplete( );
 
  return output;
    }
View Full Code Here

TOP

Related Classes of com.cloudloop.storage.internal.CloudStoreObjectMetadata

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.