View Javadoc

1   /**
2    *
3    * Copyright 2003-2004 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  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  //
19  // This source code implements specifications defined by the Java
20  // Community Process. In order to remain compliant with the specification
21  // DO NOT add / change / or delete method signatures!
22  //
23  
24  package javax.enterprise.deploy.spi;
25  
26  import javax.enterprise.deploy.model.DeployableObject;
27  import javax.enterprise.deploy.model.DDBeanRoot;
28  import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
29  import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
30  import java.io.OutputStream;
31  import java.io.InputStream;
32  
33  /**
34   * An interface that defines a container for all the server-specific configuration
35   * information for a single top-level J2EE module.  The DeploymentConfiguration
36   * object could represent a single stand alone module or an EAR file that contains
37   * several sub-modules.
38   *
39   * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
40   */
41  public interface DeploymentConfiguration {
42      /**
43       * Returns an object that provides access to the deployment descriptor data
44       * and classes of a J2EE module.
45       *
46       * @return A DeployableObject
47       */
48      public DeployableObject getDeployableObject();
49  
50      /**
51       * Returns the top level configuration bean, DConfigBeanRoot, associated with
52       * the deployment descriptor represented by the designated DDBeanRoot bean.
53       *
54       * @param bean The top level bean that represents the associated deployment descriptor.
55       *
56       * @return the DConfigBeanRoot for editing the server-specific properties required by the module.
57       *
58       * @throws ConfigurationException reports errors in generating a configuration bean
59       */
60      public DConfigBeanRoot getDConfigBeanRoot(DDBeanRoot bean) throws ConfigurationException;
61  
62      /**
63       * Remove the root DConfigBean and all its children.
64       *
65       * @param bean the top leve DConfigBean to remove.
66       *
67       * @throws BeanNotFoundException the bean provided is not in this beans child list.
68       */
69      public void removeDConfigBean(DConfigBeanRoot bean) throws BeanNotFoundException;
70  
71      /**
72       * Restore from disk to instantated objects all the DConfigBeans associated with a
73       * specific deployment descriptor. The beans may be fully or partially configured.
74       *
75       * @param inputArchive The input stream for the file from which the DConfigBeans
76       *                     should be restored.
77       * @param bean         The DDBeanRoot bean associated with the deployment descriptor file.
78       *
79       * @return The top most parent configuration bean, DConfigBeanRoot
80       *
81       * @throws ConfigurationException reports errors in generating a configuration bean
82       */
83      public DConfigBeanRoot restoreDConfigBean(InputStream inputArchive, DDBeanRoot bean) throws ConfigurationException;
84  
85      /**
86       * Save to disk all the configuration beans associated with a particular deployment
87       * descriptor file. The saved data may be fully or partially configured DConfigBeans.
88       * The output file format is recommended to be XML.
89       *
90       * @param outputArchive The output stream to which the DConfigBeans should be saved.
91       * @param bean          The top level bean, DConfigBeanRoot, from which to be save.
92       *
93       * @throws ConfigurationException reports errors in storing a configuration bean
94       */
95      public void saveDConfigBean(OutputStream outputArchive, DConfigBeanRoot bean) throws ConfigurationException;
96  
97      /**
98       * Restore from disk to a full set of configuration beans previously stored.
99       *
100      * @param inputArchive The input stream from which to restore the Configuration.
101      *
102      * @throws ConfigurationException reports errors in generating a configuration bean
103      */
104     public void restore(InputStream inputArchive) throws ConfigurationException;
105 
106     /**
107      * Save to disk the current set configuration beans created for this deployable
108      * module.  It is recommended the file format be XML.
109      *
110      * @param outputArchive The output stream to which to save the Configuration.
111      *
112      * @throws ConfigurationException reports errors in storing a configuration bean
113      */
114     public void save(OutputStream outputArchive) throws ConfigurationException;
115 }