KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > common > deployer > ArchiveBuilder


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * 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.PropertyReader;
32 import org.enhydra.tool.archive.ArchiveTool;
33 import org.enhydra.tool.archive.JarPlan;
34 import org.enhydra.tool.archive.WarPlan;
35 import org.enhydra.tool.archive.EjbPlan;
36 import org.enhydra.tool.archive.EarPlan;
37 import org.enhydra.tool.common.PathHandle;
38
39 // JDK
40
import java.io.File JavaDoc;
41 import java.util.Properties JavaDoc;
42 //
43
public class ArchiveBuilder extends AbstractEchoBuilder {
44     //
45
public ArchiveBuilder(WriteListener listener) {
46         super(listener);
47     }
48
49     // implement AbstractEchoBuilder
50
public void buildImpl() {
51         ArchiveTool tool = null;
52         JarPlan[] plans = new JarPlan[0];
53
54         tool = new ArchiveTool();
55         plans = getProject().getArchivePlans(true);
56
57         for (int i = 0; i < plans.length; i++) {
58             PathHandle ph = null;
59             File JavaDoc archive = null;
60
61             try {
62
63                 plans[i].setClassFiltering(true);
64
65         //Dusan
66
if (plans[i] instanceof EjbPlan) {
67         } else if (plans[i] instanceof EarPlan) {
68         } else if (plans[i] instanceof WarPlan) {
69         } else {
70         }
71
72 //Dusan
73
// if(getProject().getDeployType()==1) {
74
archive = tool.buildArchive(plans[i]);
75 /* } else if(getProject().getDeployType()==0) {
76                 archive = tool.buildArchive((JarPlan)plansw[i]);
77         } */

78
79                 ph = PathHandle.createPathHandle(archive);
80                 if (ph.isFile()) {
81                     echo("Created archive: " + ph.getPath());
82                 }
83             } catch (ArchiveException e) {
84                 echo("Error creating : " + plans[i].getArchivePath());
85                 echo(e);
86             }
87         }
88     }
89
90 }
91
Popular Tags