org.apache.felix.ipojo.manipulator.store
Class DirectoryResourceStore

java.lang.Object
  extended by org.apache.felix.ipojo.manipulator.store.DirectoryResourceStore
All Implemented Interfaces:
ResourceStore

public class DirectoryResourceStore
extends java.lang.Object
implements ResourceStore

A DirectoryResourceStore knows how to read and write resources from (to respectively) a File directory.

Author:
Felix Project Team

Constructor Summary
DirectoryResourceStore(java.io.File source)
           
DirectoryResourceStore(java.io.File source, java.io.File target)
           
 
Method Summary
 void accept(ResourceVisitor visitor)
          Browse all resources available in this store.
 void close()
          Close the store: no methods will be called anymore on this instance.
 void open()
          Notify the store that resource will be written.
 byte[] read(java.lang.String path)
          Return the bytecode of the given class name.
 void setManifest(java.util.jar.Manifest manifest)
           
 void setManifestBuilder(ManifestBuilder manifestBuilder)
           
 void setManifestFile(java.io.File manifestFile)
           
 void setResourceMapper(ResourceMapper mapper)
           
 void write(java.lang.String resourcePath, byte[] bytecode)
          Notify the builder that a new resource has been built and should be stored in the resulting bundle.
 void writeMetadata(org.apache.felix.ipojo.metadata.Element metadata)
          Writes the given Element into this store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryResourceStore

public DirectoryResourceStore(java.io.File source)

DirectoryResourceStore

public DirectoryResourceStore(java.io.File source,
                              java.io.File target)
Method Detail

setResourceMapper

public void setResourceMapper(ResourceMapper mapper)

setManifestBuilder

public void setManifestBuilder(ManifestBuilder manifestBuilder)

setManifest

public void setManifest(java.util.jar.Manifest manifest)

setManifestFile

public void setManifestFile(java.io.File manifestFile)

read

public byte[] read(java.lang.String path)
            throws java.io.IOException
Description copied from interface: ResourceStore
Return the bytecode of the given class name.

Specified by:
read in interface ResourceStore
Parameters:
path - normalized resource path (format: org/objectweb/asm/Visitor.class)
Returns:
the byte array representing the given class
Throws:
java.io.IOException - if resource was not found

accept

public void accept(ResourceVisitor visitor)
Description copied from interface: ResourceStore
Browse all resources available in this store.

Specified by:
accept in interface ResourceStore
Parameters:
visitor - is called for each available resource

open

public void open()
          throws java.io.IOException
Description copied from interface: ResourceStore
Notify the store that resource will be written.

Specified by:
open in interface ResourceStore
Throws:
java.io.IOException - if there was an error

writeMetadata

public void writeMetadata(org.apache.felix.ipojo.metadata.Element metadata)
Description copied from interface: ResourceStore
Writes the given Element into this store. Typically a store implementation will use this to build a Manifest.

Specified by:
writeMetadata in interface ResourceStore
Parameters:
metadata - Element metadata to be inserted

write

public void write(java.lang.String resourcePath,
                  byte[] bytecode)
           throws java.io.IOException
Description copied from interface: ResourceStore
Notify the builder that a new resource has been built and should be stored in the resulting bundle.

Specified by:
write in interface ResourceStore
Parameters:
resourcePath - resource name of the class (format: org/objectweb/asm/Visitor.class)
bytecode - content of the resource
Throws:
java.io.IOException - if there was an error storing the resource

close

public void close()
           throws java.io.IOException
Description copied from interface: ResourceStore
Close the store: no methods will be called anymore on this instance.

Specified by:
close in interface ResourceStore
Throws:
java.io.IOException - if close failed


Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.