KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > services > deployment > DeploymentServiceMBean


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.services.deployment;
23
24 import java.net.URL JavaDoc;
25 import java.util.HashMap JavaDoc;
26 import java.util.List JavaDoc;
27 import java.util.Set JavaDoc;
28
29 import org.jboss.system.ListenerServiceMBean;
30
31 /**
32  * MBean interface.
33  *
34  * @author <a HREF="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
35  * @author <a HREF="mailto:peter.johnson2@unisys.com">Peter Johnson</a>
36  * @version $Revision: 43404 $
37  */

38 public interface DeploymentServiceMBean extends ListenerServiceMBean
39 {
40    // Attributes ----------------------------------------------------
41

42    /**
43     * Sets the directory where templates are stored
44     */

45    void setTemplateDir(String JavaDoc templateDir);
46
47    /**
48     * Gets the directory where templates are stored
49     */

50    String JavaDoc getTemplateDir();
51
52    /**
53     * Sets the directory where new deployments are produced
54     */

55    void setUndeployDir(String JavaDoc undeployDir);
56
57    /**
58     * Gets the directory where new deployments are produced
59     */

60    String JavaDoc getUndeployDir();
61
62    /**
63     * Sets the directory where modules should be deployed
64     */

65    void setDeployDir(String JavaDoc deployDir);
66
67    /**
68     * Gets the directory where modules should be deployed
69     */

70    String JavaDoc getDeployDir();
71
72    // Operations -----------------------------------------------------
73

74    /**
75     * Return the set of available deployment templates
76     * Set<String>
77     */

78    Set JavaDoc listModuleTemplates();
79
80    /**
81     * Get property metadata information for a particular template
82     * List<PropertyInfo>
83     */

84    List JavaDoc getTemplatePropertyInfo(String JavaDoc template) throws Exception JavaDoc;
85
86    /**
87     * Generate a new module based on the specified template
88     * and the input properties
89     */

90    String JavaDoc createModule(String JavaDoc module, String JavaDoc template, HashMap JavaDoc properties) throws Exception JavaDoc;
91
92    /**
93     * Used primarily for testing through the jmx-console
94     */

95    String JavaDoc createModule(String JavaDoc module, String JavaDoc template, String JavaDoc[] properties) throws Exception JavaDoc;
96
97    /**
98     * Remove a module if exists
99     */

100    boolean removeModule(String JavaDoc module);
101
102    /**
103     * Update an existing module based on the specified template and the input
104     * properties
105     * @param data Data used to update the mbean descriptor. The name and
106     * templateName properties are required.
107     * @return True if MBean successfully updated, false otherwise.
108     */

109    boolean updateMBean(MBeanData data) throws Exception JavaDoc;
110
111    /**
112     * Update an existing data source based on the specified template
113     * and the input properties. Note that this method takes the exact same
114     * parameters as the createModule method. Thus the client code for creating
115     * a new data source or updating an existing data source can be the same, and
116     * only the code that makes the deployment service call needs to differentiate
117     * between calling createModule and updateDataSource.
118     * <p>
119     * Before updating a data source, you will need to gather the properties for the
120     * existing data source. The properties can be found in the following MBeans
121     * (where XXX is the data source jndi name, and YYY corresponds to the transaction
122     * type: NoTxCM, LocalTxCM, XATxCM):
123     * <ul>
124     * <li>jboss.jca:name=XXX,service=DataSourceBinding</li>
125     * <li>jboss.jca:name=XXX,service=YYY</li>
126     * <li>jboss.jca:name=XXX,service=ManagedConnectionFactory</li>
127     * <li>jboss.jca:name=XXX,service=ManagedConnectionPool</li>
128     * <li>jboss.jdbc:datasource=XXX,service=metadata</li>
129     * </ul>
130     * The service=metadata MBean provides the type-mapping, which should be provided
131     * as a property named "type-mapping".
132     * <p>
133     * To find the dependencies, get the jboss.system:service=ServiceController MBean
134     * and invoke the listDeployed method. Then search through the returned results for
135     * the jboss.jca:name=XXX,service=ManagedConnectionFactory MBean. That entry will
136     * contain the dependecies. Note that there will be an extra implied dependency
137     * named "jboss.jca:service=RARDeployment,name='jboss-ZZZ-jdbc.rar'", where ZZZ
138     * is 'local' (local and no transaction types) or 'xa'. Ignore this
139     * extra dependency, do not provide it when doing an update.
140     *
141     * @param module The name of the model that contains the data source definition.
142     * For example, the default data source, DefaultDS, is typically found in a
143     * module named "hsqldb-ds.xml", with "hsqldb" being an acceptable abbreviation.
144     * @param template The name of the template to use to update the data source.
145     * You must select the proper template based on the data source transaction type.
146     * Use one of the following: "local-tx-datasource", "no-tx-datasource", or
147     * "xa-datasource". Alternatively, you could add the "-update" suffix; for
148     * example, "local-tx-datasource-update" is the same as "local-tx-datasource".
149     * @param MashMap The collection of properties used for the data source. See
150     * the template-config.xml file for the given template (in template directory)
151     * for expected property names.
152     * @return The full module name, with the suffix. For example, "hsqldb-ds.xml".
153     */

154    String JavaDoc updateDataSource(String JavaDoc module, String JavaDoc template, HashMap JavaDoc properties) throws Exception JavaDoc;
155
156    /**
157     * Remove an existing data source based on the specified template
158     * and the input properties. This method takes the same parameters
159     * as the updateDataSource method. Refer to the comments of the
160     * updateDataSource method for more descriptions.
161     * @param module The name of the model that contains the data source definition.
162     * See the module parameter under updateDataSource for more information.
163     * @param template There is only one delete template: "datasource". Optionally,
164     * you can use the template name "datasource-remove".
165     * @param properties The key property to provide is "jndi-name". This property
166     * if used to determine which data source to remove.
167     * @return The full module name, with the suffix.
168     * @see #updateDataSource(String, String, HashMap)
169     */

170    String JavaDoc removeDataSource(String JavaDoc module, String JavaDoc template, HashMap JavaDoc properties) throws Exception JavaDoc;
171
172    /**
173     * Move a module to the deploy directory
174     */

175    void deployModuleAsynch(String JavaDoc module) throws Exception JavaDoc;
176
177    /**
178     * Get the URL of a deployed module
179     */

180    URL JavaDoc getDeployedURL(String JavaDoc module) throws Exception JavaDoc;
181
182    /**
183     * Move a module to the undeploy directory
184     */

185    void undeployModuleAsynch(String JavaDoc module) throws Exception JavaDoc;
186
187    /**
188     * Get the URL of an undeployed module
189     */

190    URL JavaDoc getUndeployedURL(String JavaDoc module) throws Exception JavaDoc;
191
192    /**
193     * Upload a new library to server lib dir. A different
194     * filename may be specified, when writing the library.
195     *
196     * If the target filename exists, upload is not performed.
197     *
198     * @param src the source url to copy
199     * @param filename the filename to use when copying (optional)
200     * @return true if upload was succesful, false otherwise
201     */

202    public boolean uploadLibrary(URL JavaDoc src, String JavaDoc filename);
203
204 }
205
Popular Tags