KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > ThemeServer


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package org.jboss.portal.server;
9
10 import org.jboss.portal.server.metadata.ServerRegistrationMetaData;
11 import org.jboss.portal.server.metadata.ThemeRegistrationMetaData;
12 import org.jboss.portal.server.theme.PortalTheme;
13 import org.jboss.portal.server.theme.ThemeException;
14
15 import java.util.Collection JavaDoc;
16
17 /**
18  * The ThemeServer is the location where all the available themes are stored and retrieved.
19  * <p>The theme server works together with a deployer to register and unregister themes. The portal can access the
20  * theme server via the server manager, and query it for available themes.</P>
21  *
22  * @author <a HREF="mailto:mholzner@novell.com">Martin Holzner</a>.
23  * @version <tt>$Revision: 1.1 $</tt>
24  */

25 public interface ThemeServer
26 {
27    /**
28     * Add a theme.
29     *
30     * @jmx.managed-operation
31     * @jmx.managed-parameter
32     * name="metaData"
33     * type="org.jboss.portal.server.metadata.ThemeRegistrationMetaData"
34     *
35     * @param metaData the meta data about the theme
36     */

37    void addTheme(ThemeRegistrationMetaData metaData) throws ThemeException;
38
39    /**
40     * Set the default theme on a global scope.
41     *
42     * @jmx.managed-attribute
43     *
44     * @param themeID the registration id of the theme to be the new default theme
45     * @throws ThemeException if the theme with this id is not available in the list of currently registered themes
46     */

47    void setDefault(ServerRegistrationID themeID) throws ThemeException;
48
49    /**
50     * Remove the theme from the available themes.
51     *
52     * @jmx.managed-operation
53     * @jmx.managed-parameter
54     * name="themeID"
55     * type="org.jboss.portal.server.ServerRegistrationID"
56     *
57     * @param themeID the registration id of the theme to be removed
58     * @throws ThemeException if the theme with this id is not available in the list of currently registered themes
59     */

60    void removeTheme(ServerRegistrationID themeID) throws ThemeException;
61
62    /**
63     * Remove all themes that are registered with the provided application.
64     * <p>On deployment of a new application, the theme descriptor (if any present) in that application is parsed for
65     * themes that are to be registered with the theme server. For each entry in the descriptor, a new theme is registered
66     * with the theme server. Uppon undeployment of that same application, all themes must be deregistered. This method
67     * is a convenient way to achieve this.
68     *
69     * @jmx.managed-operation
70     * @jmx.managed-parameter
71     * name="applicationName"
72     * type="java.lang.String"
73     *
74     * @param applicationName the name of the application that hosts the themes to unregister
75     * @throws ThemeException if there are no themes registered with this application, or if an error occurs during the remove
76     */

77    void removeThemes(String JavaDoc applicationName) throws ThemeException;
78
79    /**
80     * Get a reference to a theme.
81     *
82     * @jmx.managed-operation
83     * @jmx.managed-parameter
84     * name="themeID"
85     * type="org.jboss.portal.server.ServerRegistrationID"
86     * @jmx.managed-parameter
87     * name="defaultOnNull"
88     * type="boolean"
89     *
90     * @param themeID the registration id of the theme to retrieve
91     * @param defaultOnNull true, when the server should return the default theme, in case the requested is not found
92     * @return the requested theme, null, or the default theme if <code>defaultOnNull</code> was provided as true
93     * @throws IllegalArgumentException if the themeID is null
94     */

95    PortalTheme getTheme(ServerRegistrationID themeID, boolean defaultOnNull);
96
97    /**
98     * Get a reference to a theme.
99     *
100     * @jmx.managed-operation
101     * @jmx.managed-parameter
102     * name="name"
103     * type="java.lang.String"
104     * @jmx.managed-parameter
105     * name="defaultOnNull"
106     * type="boolean"
107     *
108     * @param name the name of the theme to retrieve
109     * @param defaultOnNull true, when the server should return the default theme, in case the requested is not found
110     * @return the requested theme, null, or the default theme if <code>defaultOnNull</code> was provided as true
111     * @throws IllegalArgumentException if the themeID is null
112     */

113    PortalTheme getTheme(String JavaDoc name, boolean defaultOnNull);
114
115    /**
116     * Get a Collection of all registered themes.
117     *
118     * @jmx.managed-attribute
119     *
120     * @return a Collection of all registered themes
121     */

122    Collection JavaDoc getThemes();
123
124    /**
125     * Get a Collection of all the registered theme's names
126     *
127     * @jmx.managed-attribute
128     *
129     * @return a collection of theme names
130     */

131    Collection JavaDoc getThemeNames();
132 }
133
Popular Tags