KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.net.MalformedURLException JavaDoc;
14 import java.net.URL JavaDoc;
15
16 /**
17  * Site archive model object.
18  * <p>
19  * This class may be instantiated or subclassed by clients. However, in most
20  * cases clients should instead instantiate or subclass the provided
21  * concrete implementation of this model.
22  * </p>
23  * <p>
24  * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
25  * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
26  * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
27  * (repeatedly) as the API evolves.
28  * </p>
29  * @see org.eclipse.update.core.ArchiveReference
30  * @since 2.0
31  */

32 public class ArchiveReferenceModel extends ModelObject {
33
34     private String JavaDoc path;
35     private String JavaDoc urlString;
36     private URL JavaDoc url;
37
38     /**
39      * Creates a uninitialized model object.
40      *
41      * @since 2.0
42      */

43     public ArchiveReferenceModel() {
44         super();
45     }
46
47     /**
48      * Retrieve the site archive "symbolic" path
49      *
50      * @return path, or <code>null</code>
51      * @since 2.0
52      */

53     public String JavaDoc getPath() {
54         return path;
55     }
56
57     /**
58      * Returns the unresolved URL string for the archive.
59      *
60      * @return url string, or <code>null</code>
61      * @since 2.0
62      */

63     public String JavaDoc getURLString() {
64         return urlString;
65     }
66
67     /**
68      * Returns the resolved URL for the archive.
69      *
70      * @return url, or <code>null</code>
71      * @since 2.0
72      */

73     public URL JavaDoc getURL() {
74         return url;
75     }
76
77     /**
78      * Sets the site archive "symbolic" path.
79      * Throws a runtime exception if this object is marked read-only.
80      *
81      * @param path archive "symbolic" path.
82      * @since 2.0
83      */

84     public void setPath(String JavaDoc path) {
85         assertIsWriteable();
86         this.path = path;
87     }
88
89     /**
90      * Sets the unresolved URL string for the archive.
91      * Throws a runtime exception if this object is marked read-only.
92      *
93      * @param urlString unresolved url string.
94      * @since 2.0
95      */

96     public void setURLString(String JavaDoc urlString) {
97         assertIsWriteable();
98         this.urlString = urlString;
99         this.url = null;
100     }
101
102     /**
103      * Resolve the model object.
104      * Any URL strings in the model are resolved relative to the
105      * base URL argument. Any translatable strings in the model that are
106      * specified as translation keys are localized using the supplied
107      * resource bundle.
108      *
109      * @param base URL
110      * @param bundleURL resource bundle URL
111      * @exception MalformedURLException
112      * @since 2.0
113      */

114     public void resolve(URL JavaDoc base,URL JavaDoc bundleURL)
115         throws MalformedURLException JavaDoc {
116         // resolve local elements
117
url = resolveURL(base, bundleURL, urlString);
118     }
119 }
120
Popular Tags