KickJava   Java API By Example, From Geeks To Geeks.

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


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

33 public class InstallHandlerEntryModel extends ModelObject {
34
35     private String JavaDoc urlString;
36     private URL JavaDoc url;
37     private String JavaDoc library;
38     private String JavaDoc name;
39
40     /**
41      * Creates a uninitialized install handler entry model object.
42      *
43      * @since 2.0
44      */

45     public InstallHandlerEntryModel() {
46         super();
47     }
48
49     /**
50      * Returns the URL string used for browser-triggered installation handling.
51      *
52      * @return url string or <code>null</code>
53      * @since 2.0
54      */

55     public String JavaDoc getURLString() {
56         return urlString;
57     }
58
59     /**
60      * Returns the resolved URL used for browser-triggered installation handling.
61      *
62      * @return url, or <code>null</code>
63      * @since 2.0
64      */

65     public URL JavaDoc getURL() {
66         return url;
67     }
68
69     /**
70      * Returns the name of the custom installer library.
71      *
72      * @return library path, or <code>null</code>
73      * @since 2.0
74      */

75     public String JavaDoc getLibrary() {
76         return library;
77     }
78
79     /**
80      * Returns the name of the custom installer.
81      *
82      * @return handler name, or <code>null</code>
83      * @since 2.0
84      */

85     public String JavaDoc getHandlerName() {
86         return name;
87     }
88
89     /**
90      * Sets URL string used for browser-triggered installation handling.
91      * Throws a runtime exception if this object is marked read-only.
92      *
93      * @param urlString trigget page URL string, may be <code>null</code>.
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      * Sets the custom install handler library name.
104      * Throws a runtime exception if this object is marked read-only.
105      *
106      * @param library name, may be <code>null</code>.
107      * @since 2.0
108      */

109     public void setLibrary(String JavaDoc library) {
110         assertIsWriteable();
111         this.library = library;
112     }
113
114     /**
115      * Sets the name of the custom install handler.
116      * Throws a runtime exception if this object is marked read-only.
117      *
118      * @param name name of the install handler, may be <code>null</code>.
119      * @since 2.0
120      */

121     public void setHandlerName(String JavaDoc name) {
122         assertIsWriteable();
123         this.name = name;
124     }
125
126     /**
127      * Resolve the model object.
128      * Any URL strings in the model are resolved relative to the
129      * base URL argument. Any translatable strings in the model that are
130      * specified as translation keys are localized using the supplied
131      * resource bundle.
132      *
133      * @param base URL
134      * @param bundleURL resource bundle URL
135      * @exception MalformedURLException
136      * @since 2.0
137      */

138     public void resolve(URL JavaDoc base,URL JavaDoc bundleURL)
139         throws MalformedURLException JavaDoc {
140         // resolve local elements
141
url = resolveURL(base,bundleURL, urlString);
142     }
143 }
144
Popular Tags