KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > core > model > ContentEntryModel


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.update.core.model;
12
13
14 /**
15  * Content entry model object.
16  * This is the base class for plug-in and non-plug-in entry models.
17  * <p>
18  * This class must be subclassed by clients.
19  * </p>
20  * <p>
21  * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
22  * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
23  * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
24  * (repeatedly) as the API evolves.
25  * </p>
26  * @see org.eclipse.update.core.model.PluginEntryModel
27  * @see org.eclipse.update.core.model.NonPluginEntryModel
28  * @since 2.0
29  */

30 public abstract class ContentEntryModel extends ModelObject {
31
32     /**
33      * An indication the size could not be determined
34      *
35      * @since 2.0
36      */

37     public static final long UNKNOWN_SIZE = -1;
38
39     private long downloadSize = UNKNOWN_SIZE;
40     private long installSize = UNKNOWN_SIZE;
41     private String JavaDoc os;
42     private String JavaDoc ws;
43     private String JavaDoc nl;
44     private String JavaDoc arch;
45
46     /**
47      * Creates a uninitialized content entry model object.
48      *
49      * @since 2.0
50      */

51     protected ContentEntryModel() {
52         super();
53     }
54
55     /**
56      * Returns the download size of the entry, if it can be determined.
57      *
58      * @return download size of the entry in KiloBytes, or an indication
59      * the size could not be determined
60      * @since 2.0
61      */

62
63     public long getDownloadSize() {
64         return downloadSize;
65     }
66
67     /**
68      * Returns the install size of the entry, if it can be determined.
69      *
70      * @return install size of the entry in KiloBytes, or an indication
71      * the size could not be determined
72      * @since 2.0
73      */

74     public long getInstallSize() {
75         return installSize;
76     }
77
78     /**
79      * Returns optional operating system specification.
80      *
81      * @return the operating system specification or <code>null</code>.
82      * @since 2.0
83      */

84     public String JavaDoc getOS() {
85         return os;
86     }
87
88     /**
89      * Returns optional windowing system specification.
90      *
91      * @return the windowing system specification or <code>null</code>.
92      * @since 2.0
93      */

94
95     public String JavaDoc getWS() {
96         return ws;
97     }
98
99     /**
100      * Returns optional system architecture specification.
101      *
102      * @return the system architecture specification or <code>null</code>.
103      * @since 2.0
104      */

105     public String JavaDoc getOSArch() {
106         return arch;
107     }
108
109     /**
110      * Returns optional locale specification.
111      *
112      * @return the locale specification, or <code>null</code>.
113      * @since 2.0
114      */

115     public String JavaDoc getNL() {
116         return nl;
117     }
118
119     /**
120      * Sets the download size of the entry.
121      * Throws a runtime exception if this object is marked read-only.
122      *
123      * @param downloadSize download size of the entry in KiloBytes
124      * @since 2.0
125      */

126     public void setDownloadSize(long downloadSize) {
127         assertIsWriteable();
128         if (downloadSize < 0)
129             this.downloadSize = UNKNOWN_SIZE;
130         else
131             this.downloadSize = downloadSize;
132     }
133
134     /**
135      * Sets the install size of the entry.
136      * Throws a runtime exception if this object is marked read-only.
137      *
138      * @param installSize install size of the entry in KiloBytes
139      * @since 2.0
140      */

141     public void setInstallSize(long installSize) {
142         assertIsWriteable();
143         if (installSize < 0)
144             this.installSize = UNKNOWN_SIZE;
145         else
146             this.installSize = installSize;
147     }
148
149     /**
150      * Sets the operating system specification.
151      * Throws a runtime exception if this object is marked read-only.
152      *
153      * @param os comma-separated list of OS identifiers as defined by Eclipse.
154      * @since 2.0
155      */

156     public void setOS(String JavaDoc os) {
157         assertIsWriteable();
158         this.os = os;
159     }
160
161     /**
162      * Sets the windowing system specification.
163      * Throws a runtime exception if this object is marked read-only.
164      *
165      * @param ws comma-separated list of WS identifiers as defined by Eclipse.
166      * @since 2.0
167      */

168     public void setWS(String JavaDoc ws) {
169         assertIsWriteable();
170         this.ws = ws;
171     }
172
173     /**
174      * Sets the system architecture specification.
175      * Throws a runtime exception if this object is marked read-only.
176      *
177      * @param arch comma-separated list of arch identifiers as defined by Eclipse.
178      * @since 2.0
179      */

180     public void setArch(String JavaDoc arch) {
181         assertIsWriteable();
182         this.arch = arch;
183     }
184
185     /**
186      * Sets the locale specification.
187      * Throws a runtime exception if this object is marked read-only.
188      *
189      * @param nl comma-separated list of locale identifiers.
190      * @since 2.0
191      */

192     public void setNL(String JavaDoc nl) {
193         assertIsWriteable();
194         this.nl = nl;
195     }
196 }
197
Popular Tags