|
Lines 35-48
import org.eclipse.virgo.util.io.PathReference;
Link Here
|
| 35 |
* Files cannot be added, only changed or removed. Actual transformation of files is performed by an implementation of |
35 |
* Files cannot be added, only changed or removed. Actual transformation of files is performed by an implementation of |
| 36 |
* the {@link DirTransformerCallback} interface. |
36 |
* the {@link DirTransformerCallback} interface. |
| 37 |
*/ |
37 |
*/ |
| 38 |
public class DirTransformer { |
38 |
final class DirTransformer { |
| 39 |
|
39 |
|
| 40 |
/** |
40 |
/** |
| 41 |
* Callback interface used to transform files in a directory. |
41 |
* Callback interface used to transform files in a directory. |
| 42 |
* |
42 |
* |
| 43 |
* @see DirTransformer |
43 |
* @see DirTransformer |
| 44 |
*/ |
44 |
*/ |
| 45 |
public static interface DirTransformerCallback { |
45 |
static interface DirTransformerCallback { |
| 46 |
|
46 |
|
| 47 |
/** |
47 |
/** |
| 48 |
* Transform the supplied file. |
48 |
* Transform the supplied file. |
|
Lines 75-81
public class DirTransformer {
Link Here
|
| 75 |
* |
75 |
* |
| 76 |
* @param callback the <code>DirTransformerCallback</code> to use for file transformation. |
76 |
* @param callback the <code>DirTransformerCallback</code> to use for file transformation. |
| 77 |
*/ |
77 |
*/ |
| 78 |
public DirTransformer(DirTransformerCallback callback) { |
78 |
DirTransformer(DirTransformerCallback callback) { |
| 79 |
if (callback == null) { |
79 |
if (callback == null) { |
| 80 |
throw new IllegalArgumentException("Callback must not be null"); |
80 |
throw new IllegalArgumentException("Callback must not be null"); |
| 81 |
} |
81 |
} |
|
Lines 89-95
public class DirTransformer {
Link Here
|
| 89 |
* @param transformedUrl the {@link URL} to write the transformed directory to. |
89 |
* @param transformedUrl the {@link URL} to write the transformed directory to. |
| 90 |
* @throws IOException if the directory cannot be transformed. |
90 |
* @throws IOException if the directory cannot be transformed. |
| 91 |
*/ |
91 |
*/ |
| 92 |
public void transform(URL url, URL transformedUrl) throws IOException { |
92 |
void transform(URL url, URL transformedUrl) throws IOException { |
| 93 |
transform(url, transformedUrl, false); |
93 |
transform(url, transformedUrl, false); |
| 94 |
} |
94 |
} |
| 95 |
|
95 |
|
|
Lines 101-107
public class DirTransformer {
Link Here
|
| 101 |
* @param ensureManifestIsPresent if <code>true</code> ensures that the transformed directory contains a manifest. |
101 |
* @param ensureManifestIsPresent if <code>true</code> ensures that the transformed directory contains a manifest. |
| 102 |
* @throws IOException if the directory cannot be transformed. |
102 |
* @throws IOException if the directory cannot be transformed. |
| 103 |
*/ |
103 |
*/ |
| 104 |
public void transform(URL url, URL transformedUrl, boolean ensureManifestIsPresent) throws IOException { |
104 |
void transform(URL url, URL transformedUrl, boolean ensureManifestIsPresent) throws IOException { |
| 105 |
PathReference fromDirectory = new PathReference(url.getPath()); |
105 |
PathReference fromDirectory = new PathReference(url.getPath()); |
| 106 |
PathReference toDirectory = new PathReference(transformedUrl.getPath()); |
106 |
PathReference toDirectory = new PathReference(transformedUrl.getPath()); |
| 107 |
transformDir(fromDirectory, toDirectory); |
107 |
transformDir(fromDirectory, toDirectory); |