KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > kernel > config > ConfigurationStore


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.geronimo.kernel.config;
19
20 import java.io.File JavaDoc;
21 import java.io.IOException JavaDoc;
22 import java.io.OutputStream JavaDoc;
23 import java.net.MalformedURLException JavaDoc;
24 import java.util.List JavaDoc;
25 import java.util.Set JavaDoc;
26
27 import org.apache.geronimo.kernel.repository.Artifact;
28 import org.apache.geronimo.gbean.AbstractName;
29
30 /**
31  * Interface to a store for Configurations.
32  *
33  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
34  */

35 public interface ConfigurationStore {
36     
37     /**
38      * Determines if the identified configuration is an in-place one. This
39      * means that the configuration store only stores some meta-data and the
40      * actual content of the configuration is rooted somewhere else.
41      *
42      * @param configId the unique ID of the configuration, which must be fully
43      * resolved (isResolved() == true)
44      *
45      * @return true if the identified configuration is an in-place one.
46      *
47      * @throws NoSuchConfigException if the configuration is not contained in
48      * the store
49      * @throws IOException If the store cannot be read.
50      */

51     boolean isInPlaceConfiguration(Artifact configId) throws NoSuchConfigException, IOException JavaDoc;
52     
53     /**
54      * Move the unpacked configuration directory into this store
55      *
56      * @param configurationData the configuration data
57      * @throws IOException if the direcotyr could not be moved into the store
58      * @throws InvalidConfigException if there is a configuration problem within the source direcotry
59      */

60     void install(ConfigurationData configurationData) throws IOException JavaDoc, InvalidConfigException;
61
62     /**
63      * Removes a configuration from the store
64      *
65      * @param configId the id of the configuration to remove, which must be
66      * fully resolved (isResolved() == true)
67      *
68      * @throws NoSuchConfigException if the configuration is not contained in the store
69      * @throws IOException if a problem occurs during the removal
70      */

71     void uninstall(Artifact configId) throws NoSuchConfigException, IOException JavaDoc;
72
73     /**
74      * Loads the specified configuration into the kernel
75      *
76      * @param configId the id of the configuration to load, which must be fully
77      * resolved (isResolved() == true)
78      *
79      * @return the the configuration object
80      *
81      * @throws NoSuchConfigException if the configuration is not contained in the kernel
82      * @throws IOException if a problem occurs loading the configuration from the store
83      * @throws InvalidConfigException if the configuration is corrupt
84      */

85     ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException JavaDoc, InvalidConfigException;
86
87     /**
88      * Determines if the store contains a configuration with the specified ID.
89      * The configuration need not be loaded or running, this just checks
90      * whether the configuration store has the data for it.
91      *
92      * @param configId the unique ID of the configuration, which must be fully
93      * resolved (isResolved() == true)
94      *
95      * @return true if the store contains the configuration
96      */

97     boolean containsConfiguration(Artifact configId);
98
99     /**
100      * Return the object name for the store.
101      *
102      * @return the object name for the store
103      */

104     String JavaDoc getObjectName();
105
106     /**
107      * Return the object name for the store.
108      *
109      * @return the object name for the store
110      */

111     AbstractName getAbstractName();
112
113     /**
114      * Return the configurations in the store
115      *
116      * @return a List (with entries of type ConfigurationInfo) of all the
117      * configurations contained in this configuration store
118      */

119     List JavaDoc listConfigurations();
120
121     /**
122      * Creates an empty directory for a new configuration with the specified configId
123      *
124      * @param configId the unique ID of the configuration, which must be fully
125      * resolved (isResolved() == true)
126      *
127      * @return the location of the new directory
128      *
129      * @throws ConfigurationAlreadyExistsException if the configuration already exists in this store
130      */

131     File JavaDoc createNewConfigurationDir(Artifact configId) throws ConfigurationAlreadyExistsException;
132
133     /**
134      * Locate the physical locations which match the supplied path in the given
135      * artifact/module. The path may be an Ant-style pattern.
136      *
137      * @param configId the artifact to search, which must be fully resolved
138      * (isResolved() == true)
139      * @param moduleName the module name or null to search in the top-level
140      * artifact location
141      * @param path the pattern to search for within the artifact/module,
142      * which may also be null to identify the artifact or
143      * module base path
144      *
145      * @return a Set (with entries of type URL) of the matching locations
146      */

147     Set JavaDoc resolve(Artifact configId, String JavaDoc moduleName, String JavaDoc path) throws NoSuchConfigException, MalformedURLException JavaDoc;
148
149     /**
150      * Exports a configuration as a ZIP file.
151      *
152      * @param configId The unique ID of the configuration to export, which
153      * must be fully resolved (isResolved() == true)
154      * @param output The stream to write the ZIP content to
155      */

156     void exportConfiguration(Artifact configId, OutputStream JavaDoc output) throws IOException JavaDoc, NoSuchConfigException;
157 }
158
Popular Tags