001    /**
002     *
003     * Copyright 2003-2004 The Apache Software Foundation
004     *
005     *  Licensed under the Apache License, Version 2.0 (the "License");
006     *  you may not use this file except in compliance with the License.
007     *  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    //
019    // This source code implements specifications defined by the Java
020    // Community Process. In order to remain compliant with the specification
021    // DO NOT add / change / or delete method signatures!
022    //
023    
024    package javax.enterprise.deploy.spi;
025    
026    import javax.enterprise.deploy.model.DeployableObject;
027    import javax.enterprise.deploy.model.DDBeanRoot;
028    import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
029    import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
030    import java.io.OutputStream;
031    import java.io.InputStream;
032    
033    /**
034     * An interface that defines a container for all the server-specific configuration
035     * information for a single top-level J2EE module.  The DeploymentConfiguration
036     * object could represent a single stand alone module or an EAR file that contains
037     * several sub-modules.
038     *
039     * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
040     */
041    public interface DeploymentConfiguration {
042        /**
043         * Returns an object that provides access to the deployment descriptor data
044         * and classes of a J2EE module.
045         *
046         * @return A DeployableObject
047         */
048        public DeployableObject getDeployableObject();
049    
050        /**
051         * Returns the top level configuration bean, DConfigBeanRoot, associated with
052         * the deployment descriptor represented by the designated DDBeanRoot bean.
053         *
054         * @param bean The top level bean that represents the associated deployment descriptor.
055         *
056         * @return the DConfigBeanRoot for editing the server-specific properties required by the module.
057         *
058         * @throws ConfigurationException reports errors in generating a configuration bean
059         */
060        public DConfigBeanRoot getDConfigBeanRoot(DDBeanRoot bean) throws ConfigurationException;
061    
062        /**
063         * Remove the root DConfigBean and all its children.
064         *
065         * @param bean the top leve DConfigBean to remove.
066         *
067         * @throws BeanNotFoundException the bean provided is not in this beans child list.
068         */
069        public void removeDConfigBean(DConfigBeanRoot bean) throws BeanNotFoundException;
070    
071        /**
072         * Restore from disk to instantated objects all the DConfigBeans associated with a
073         * specific deployment descriptor. The beans may be fully or partially configured.
074         *
075         * @param inputArchive The input stream for the file from which the DConfigBeans
076         *                     should be restored.
077         * @param bean         The DDBeanRoot bean associated with the deployment descriptor file.
078         *
079         * @return The top most parent configuration bean, DConfigBeanRoot
080         *
081         * @throws ConfigurationException reports errors in generating a configuration bean
082         */
083        public DConfigBeanRoot restoreDConfigBean(InputStream inputArchive, DDBeanRoot bean) throws ConfigurationException;
084    
085        /**
086         * Save to disk all the configuration beans associated with a particular deployment
087         * descriptor file. The saved data may be fully or partially configured DConfigBeans.
088         * The output file format is recommended to be XML.
089         *
090         * @param outputArchive The output stream to which the DConfigBeans should be saved.
091         * @param bean          The top level bean, DConfigBeanRoot, from which to be save.
092         *
093         * @throws ConfigurationException reports errors in storing a configuration bean
094         */
095        public void saveDConfigBean(OutputStream outputArchive, DConfigBeanRoot bean) throws ConfigurationException;
096    
097        /**
098         * Restore from disk to a full set of configuration beans previously stored.
099         *
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    }