Statistics
| Revision:

root / import / ext3D / trunk / install-extension3d / IzPack / src / lib / com / izforge / izpack / ExecutableFile.java @ 15280

History | View | Annotate | Download (4.9 KB)

1
/*
2
 *  $Id: ExecutableFile.java,v 1.1 2006/06/14 07:29:07 cesar Exp $
3
 *  IzPack
4
 *  Copyright (C) 2001,2002 Olexij Tkatchenko
5
 *
6
 *  File :               Pack.java
7
 *  Description :        Contains informations about a pack.
8
 *  Author's email :     ot@parcs.de
9
 *  Author's Website :   N/A
10
 *
11
 *  This program is free software; you can redistribute it and/or
12
 *  modify it under the terms of the GNU General Public License
13
 *  as published by the Free Software Foundation; either version 2
14
 *  of the License, or any later version.
15
 *
16
 *  This program is distributed in the hope that it will be useful,
17
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 *  GNU General Public License for more details.
20
 *
21
 *  You should have received a copy of the GNU General Public License
22
 *  along with this program; if not, write to the Free Software
23
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24
 */
25
package com.izforge.izpack;
26

    
27
import java.io.Serializable;
28
import java.util.ArrayList;
29
import java.util.List;
30

    
31
/**
32
 *  Encloses information about a executable file. This class abstracts the way
33
 *  to do a system dependent postprocessing of installation.
34
 *
35
 * @author     Olexij Tkatchenko <ot@parcs.de>
36
 */
37

    
38
public class ExecutableFile implements Serializable
39
{
40
  /**  when to execute this file */
41
  public final static int POSTINSTALL = 0;
42
  public final static int NEVER = 1;
43
  public final static int UNINSTALL = 2;
44

    
45
  /**  type of a file */
46
  public final static int BIN = 0;
47
  public final static int JAR = 1;
48

    
49
  /**  what to do if execution fails */
50
  public final static int ABORT = 0;
51
  public final static int WARN = 1;
52
  public final static int ASK = 2;
53

    
54
  /**  The file path */
55
  public String path;
56

    
57
  /**  Execution stage (NEVER, POSTINSTALL, UNINSTALL) */
58
  public int executionStage;
59

    
60
  /**  Main class of jar file */
61
  public String mainClass;
62

    
63
  /**  type (BIN|JAR) */
64
  public int type;
65

    
66
  /**  Failure handling (ABORT, WARN, ASK) */
67
  public int onFailure;
68

    
69
  /**  List of arguments */
70
  public List argList = null;
71

    
72
  /**  List of operating systems to run on */
73
  public List osList = null;
74

    
75
  /**  Indicates the file should be kept after executing.
76
   *  Default is false for backward compatibility. */
77
  public boolean keepFile;
78

    
79
  /**  Constructs a new uninitialized instance.  */
80
  public ExecutableFile()
81
  {
82
    this.path = null;
83
    executionStage = NEVER;
84
    mainClass = null;
85
    type = BIN;
86
    onFailure = ASK;
87
    osList = new ArrayList();
88
    argList = new ArrayList();
89
    keepFile = false;
90
  }
91

    
92

    
93
  /**
94
   *  Constructs and initializes a new instance.
95
   *
96
   * @param  path            the file path
97
   * @param  executionStage  when to execute
98
   * @param  onFailure       what to do if execution fails
99
   * @param  osList          list of operating systems to run on
100
   */
101
  public ExecutableFile(String path, int executionStage,
102
                        int onFailure, java.util.List osList,
103
                        boolean keepFile)
104
  {
105
    this.path = path;
106
    this.executionStage = executionStage;
107
    this.onFailure = onFailure;
108
    this.osList = osList;
109
    this.keepFile = keepFile;
110
  }
111

    
112

    
113
  public ExecutableFile(String path,
114
                        int type,
115
                        String mainClass,
116
                        int executionStage,
117
                        int onFailure,
118
                        java.util.List argList,
119
                        java.util.List osList,
120
                        boolean keepFile)
121
  {
122
    this.path = path;
123
    this.mainClass = mainClass;
124
    this.type = type;
125
    this.executionStage = executionStage;
126
    this.onFailure = onFailure;
127
    this.argList = argList;
128
    this.osList = osList;
129
    this.keepFile = keepFile;
130
  }
131

    
132
  public String toString()
133
  {
134
    StringBuffer retval = new StringBuffer();
135
    retval.append("path = "+path);
136
    retval.append("\n");
137
    retval.append("mainClass = "+mainClass);
138
    retval.append("\n");
139
    retval.append("type = "+type);
140
    retval.append("\n");
141
    retval.append("executionStage = "+executionStage);
142
    retval.append("\n");
143
    retval.append("onFailure = "+onFailure);
144
    retval.append("\n");
145
    retval.append("argList: "+argList);
146
    retval.append("\n");
147
    if (argList != null)
148
    {
149
      for (int i = 0; i < argList.size(); i++)
150
      {
151
        retval.append("\targ: "+argList.get(i));
152
        retval.append("\n");
153
      }
154
    }
155
    retval.append("\n");
156
    retval.append("osList = "+osList);
157
    retval.append("\n");
158
    if (osList != null)
159
    {
160
      for (int i = 0; i < osList.size(); i++)
161
      {
162
        retval.append("\tos: "+osList.get(i));
163
        retval.append("\n");
164
      }
165
    }
166
    retval.append("keepFile = "+keepFile);
167
    retval.append("\n");
168
    return retval.toString();
169
  }
170
}
171