org.apache.maven.mercury.repository.metadata
Class MetadataBuilder

java.lang.Object
  extended by org.apache.maven.mercury.repository.metadata.MetadataBuilder

public class MetadataBuilder
extends java.lang.Object

utility class to help with de/serializing metadata from/to XML

Version:
$Id: MetadataBuilder.java 722796 2008-12-03 07:16:52Z ogusakov $
Author:
Oleg Gusakov

Constructor Summary
MetadataBuilder()
           
 
Method Summary
static byte[] changeMetadata(byte[] metadataBytes, java.util.List<MetadataOperation> mutators)
          apply a list of operators to the specified serialized Metadata object
static byte[] changeMetadata(byte[] metadataBytes, MetadataOperation op)
           
static byte[] changeMetadata(Metadata metadata, java.util.List<MetadataOperation> mutators)
          apply a list of operators to the specified serialized Metadata object
static byte[] changeMetadata(Metadata metadata, MetadataOperation op)
           
static Snapshot createSnapshot(java.lang.String version)
           
static byte[] getBytes(Metadata metadata)
          marshall metadata into a byte array
static Metadata getMetadata(byte[] in)
          instantiate Metadata from a byte array
static Metadata read(java.io.InputStream in)
          instantiate Metadata from a stream
static void updateTimestamp(Snapshot target)
          update snapshot timestamp to now
static void updateTimestamp(Versioning target)
          update versioning's lastUpdated timestamp to now
static Metadata write(Metadata metadata, java.io.OutputStream out)
          serialize metadata into xml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataBuilder

public MetadataBuilder()
Method Detail

read

public static Metadata read(java.io.InputStream in)
                     throws MetadataException
instantiate Metadata from a stream

Parameters:
in -
Returns:
Throws:
MetadataException

getMetadata

public static Metadata getMetadata(byte[] in)
                            throws MetadataException
instantiate Metadata from a byte array

Parameters:
in -
Returns:
Throws:
MetadataException

write

public static Metadata write(Metadata metadata,
                             java.io.OutputStream out)
                      throws MetadataException
serialize metadata into xml

Parameters:
metadata - to serialize
out - output to this stream
Returns:
same metadata as was passed in
Throws:
MetadataException - if any problems occured

changeMetadata

public static byte[] changeMetadata(byte[] metadataBytes,
                                    java.util.List<MetadataOperation> mutators)
                             throws MetadataException
apply a list of operators to the specified serialized Metadata object

Parameters:
metadataBytes - - serialized Metadata object
mutators - - operators
Returns:
changed serialized object
Throws:
MetadataException

getBytes

public static byte[] getBytes(Metadata metadata)
                       throws MetadataException
marshall metadata into a byte array

Parameters:
metadata -
Returns:
Throws:
MetadataException

changeMetadata

public static byte[] changeMetadata(Metadata metadata,
                                    java.util.List<MetadataOperation> mutators)
                             throws MetadataException
apply a list of operators to the specified serialized Metadata object

Parameters:
metadataBytes - - serialized Metadata object
mutators - - operators
Returns:
changed serialized object
Throws:
MetadataException

changeMetadata

public static byte[] changeMetadata(byte[] metadataBytes,
                                    MetadataOperation op)
                             throws MetadataException
Throws:
MetadataException

changeMetadata

public static byte[] changeMetadata(Metadata metadata,
                                    MetadataOperation op)
                             throws MetadataException
Throws:
MetadataException

updateTimestamp

public static void updateTimestamp(Snapshot target)
update snapshot timestamp to now

Parameters:
target -

updateTimestamp

public static void updateTimestamp(Versioning target)
update versioning's lastUpdated timestamp to now

Parameters:
target -

createSnapshot

public static Snapshot createSnapshot(java.lang.String version)


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.