01: /*
02: * Enhydra Java Application Server Project
03: *
04: * The contents of this file are subject to the Enhydra Public License
05: * Version 1.1 (the "License"); you may not use this file except in
06: * compliance with the License. You may obtain a copy of the License on
07: * the Enhydra web site ( http://www.enhydra.org/ ).
08: *
09: * Software distributed under the License is distributed on an "AS IS"
10: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11: * the License for the specific terms governing rights and limitations
12: * under the License.
13: *
14: * The Initial Developer of the Enhydra Application Server is Lutris
15: * Technologies, Inc. The Enhydra Application Server and portions created
16: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17: * All Rights Reserved.
18: *
19: * Contributor(s):
20: * Paul Mahar
21: *
22: */
23: package org.enhydra.kelp.common.deployer;
24:
25: // AddinCore
26: import org.enhydra.kelp.common.AbstractEchoBuilder;
27: import org.enhydra.kelp.common.event.WriteListener;
28:
29: // ToolBox
30: import org.enhydra.tool.archive.ArchiveException;
31: import org.enhydra.tool.archive.ArchiveTool;
32: import org.enhydra.tool.archive.JarPlan;
33: import org.enhydra.tool.common.PathHandle;
34:
35: // JDK
36: import java.io.File;
37:
38: //
39: public class ArchiveBuilder extends AbstractEchoBuilder {
40: //
41: public ArchiveBuilder(WriteListener listener) {
42: super (listener);
43: }
44:
45: // implement AbstractEchoBuilder
46: public void buildImpl() {
47: ArchiveTool tool = null;
48: JarPlan[] plans = new JarPlan[0];
49:
50: tool = new ArchiveTool();
51: plans = getProject().getArchivePlans(true);
52:
53: for (int i = 0; i < plans.length; i++) {
54: PathHandle ph = null;
55: File archive = null;
56:
57: try {
58:
59: plans[i].setClassFiltering(true);
60:
61: // if(getProject().getDeployType()==1) {
62: archive = tool.buildArchive(plans[i]);
63: /* } else if(getProject().getDeployType()==0) {
64: archive = tool.buildArchive((JarPlan)plansw[i]);
65: } */
66:
67: ph = PathHandle.createPathHandle(archive);
68: if (ph.isFile()) {
69: echo("Created archive: " + ph.getPath());
70: }
71: } catch (ArchiveException e) {
72: echo("Error creating : " + plans[i].getArchivePath());
73: echo(e);
74: }
75: }
76: }
77:
78: }
|