org.apache.felix.ipojo.manipulator.store

## Class DirectoryResourceStore

- java.lang.Object
- - org.apache.felix.ipojo.manipulator.store.DirectoryResourceStore

All Implemented Interfaces:
  ResourceStore

    public class DirectoryResourceStore
    extends Object
    implements ResourceStore

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

Author:
  Felix Project Team

### Constructor Summary

Constructors
Constructor and Description
`DirectoryResourceStore(File source)`
`DirectoryResourceStore(File source, File target)`

### Method Summary

All Methods Instance Methods Concrete Methods
`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(String path)` Return the bytecode of the given class name.
`void` `setManifest(Manifest manifest)`
`void` `setManifestBuilder(ManifestBuilder manifestBuilder)`
`void` `setManifestFile(File manifestFile)`
`void` `setResourceMapper(ResourceMapper mapper)`
`void` `write(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(File source)

#### DirectoryResourceStore

    public DirectoryResourceStore(File source,
                                  File target)

### Method Detail

#### setResourceMapper

    public void setResourceMapper(ResourceMapper mapper)

#### setManifestBuilder

    public void setManifestBuilder(ManifestBuilder manifestBuilder)

#### setManifest

    public void setManifest(Manifest manifest)

#### setManifestFile

    public void setManifestFile(File manifestFile)

#### read

    public byte[] read(String path)
                throws 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:
  `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 IOException

Description copied from interface: `ResourceStore`
Notify the store that resource will be written.

Specified by:
  `open` in interface `ResourceStore`
Throws:
  `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(String resourcePath,
                      byte[] bytecode)
               throws 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:
  `IOException` - if there was an error storing the resource

#### close

    public void close()
               throws 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:
  `IOException` - if close failed