01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package com.sun.midp.midletsuite;
28:
29: import java.util.Vector;
30:
31: import com.sun.midp.io.Util;
32:
33: /**
34: * Simple attribute storage for MIDlets in the descriptor/manifest.
35: */
36: public class MIDletInfo {
37: /** The name of the MIDlet. */
38: public String name;
39: /** The icon of the MIDlet. */
40: public String icon;
41: /** The main class for the MIDlet. */
42: public String classname;
43:
44: /**
45: * Parses out the name, icon and classname.
46: * @param attr contains the name, icon and classname line to be
47: * parsed
48: */
49: public MIDletInfo(String attr) {
50: Vector args;
51:
52: if (attr == null) {
53: return;
54: }
55:
56: args = Util.getCommaSeparatedValues(attr);
57: if (args.size() > 0) {
58: name = (String) args.elementAt(0);
59: if (args.size() > 1) {
60: icon = (String) args.elementAt(1);
61: if (icon.length() == 0) {
62: icon = null;
63: }
64:
65: if (args.size() > 2) {
66: classname = (String) args.elementAt(2);
67: if (classname.length() == 0) {
68: classname = null;
69: }
70: }
71: }
72: }
73: }
74:
75: /**
76: * Container class to hold information about the current MIDlet.
77: * @param name the name of the MIDlet from descriptor file or
78: * manifest
79: * @param icon the icon to display when the user selects the MIDlet
80: * from a list
81: * @param classname the main class for this MIDlet
82: */
83: public MIDletInfo(String name, String icon, String classname) {
84: this.name = name;
85: this.icon = icon;
86: this.classname = classname;
87: }
88: }
|