001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site ( http://www.enhydra.org/ ).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: * Paul Mahar
021: *
022: */
023: package org.enhydra.tool.archive;
024:
025: //
026: import org.enhydra.tool.archive.wizard.ArchiveWizard;
027: import org.enhydra.tool.common.PathHandle;
028:
029: // Standard imports
030: import java.io.File;
031: import java.util.Properties;
032:
033: //
034: public class ArchiveTool {
035:
036: // not to be resourced
037: private final String NULL_PLAN = "Archive plan is null"; // nores
038:
039: public ArchiveTool() {
040: }
041:
042: //Zeljko Kovacevic 28.10 2003 comment this
043: /* public File buildArchive(EarPlan plan) throws ArchiveException {
044: EarBuilder builder = null;
045: File file = null;
046:
047: if (plan == null) {
048: throw new ArchiveException(NULL_PLAN);
049: }
050: builder = new EarBuilder();
051: builder.setPlan(plan);
052: file = builder.buildArchive();
053: return file;
054: }
055:
056: public File buildArchive(EjbPlan plan) throws ArchiveException {
057: EjbBuilder builder = null;
058: File file = null;
059:
060: if (plan == null) {
061: throw new ArchiveException(NULL_PLAN);
062: }
063: builder = new EjbBuilder();
064: builder.setPlan(plan);
065: file = builder.buildArchive();
066: return file;
067: }
068: */
069: public File buildArchive(WarPlan plan) throws ArchiveException {
070: WarBuilder builder = null;
071: File file = null;
072:
073: if (plan == null) {
074: throw new ArchiveException(NULL_PLAN);
075: }
076: builder = new WarBuilder();
077: builder.setPlan(plan);
078: file = builder.buildArchive();
079: return file;
080: }
081:
082: public File buildArchive(JarPlan plan) throws ArchiveException {
083: JarBuilder builder = null;
084: File file = null;
085: //Zeljko Kovacevic 28.10 2003 comment this
086: /*
087: if (plan instanceof EjbPlan) {
088: file = buildArchive((EjbPlan) plan);
089: } else if (plan instanceof EarPlan) {
090: file = buildArchive((EarPlan) plan);
091: } else
092: */
093: if (plan instanceof WarPlan) {
094: file = buildArchive((WarPlan) plan);
095: } else {
096: if (plan == null) {
097: throw new ArchiveException(NULL_PLAN);
098: }
099: builder = new JarBuilder();
100: builder.setPlan(plan);
101: file = builder.buildArchive();
102: }
103: return file;
104: }
105:
106: public static JarPlan runWizard(int i) {
107: ArchiveWizard handler = null;
108: JarPlan plan = null;
109:
110: handler = new ArchiveWizard();
111: handler.showDialog(null);
112: plan = handler.getPlan();
113: handler = null;
114: return plan;
115:
116: }
117:
118: public static String runWizard() {
119: JarPlan plan = null;
120: String newArchive = null;
121: plan = ArchiveTool.runWizard(0);
122: if (plan != null) {
123: newArchive = PathHandle.createPathString(plan
124: .getArchivePath());
125: }
126: return newArchive;
127: }
128:
129: }
|