001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  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    package org.apache.geronimo.deployment;
019    
020    import java.io.File;
021    import java.io.IOException;
022    import java.util.Collection;
023    import java.util.List;
024    import java.util.jar.JarFile;
025    
026    import org.apache.geronimo.common.DeploymentException;
027    import org.apache.geronimo.deployment.DeploymentContext;
028    import org.apache.geronimo.kernel.config.ConfigurationStore;
029    import org.apache.geronimo.kernel.repository.Artifact;
030    import org.apache.geronimo.kernel.repository.ArtifactResolver;
031    
032    /**
033     * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
034     */
035    public interface ConfigurationBuilder {
036        static final String CONFIG_BUILDER = "ConfigBuilder";
037    
038        /**
039         * Builds a deployment plan specific to this builder from a planFile and/or
040         * module if this builder can process it.
041         * @param planFile the deployment plan to examine; can be null
042         * @param module the URL of the module to examine; can be null
043         * @return the deployment plan, or null if this builder can not handle the module
044         * @throws org.apache.geronimo.common.DeploymentException if there was a problem with the configuration
045         */
046        Object getDeploymentPlan(File planFile, JarFile module, ModuleIDBuilder idBuilder) throws DeploymentException;
047    
048        /**
049         * Checks what configuration URL will be used for the provided module.
050         * @param plan the deployment plan
051         * @param module the module to build
052         * @return the ID that will be used for the Configuration
053         * @throws IOException if there was a problem reading or writing the files
054         * @throws org.apache.geronimo.common.DeploymentException if there was a problem with the configuration
055         */
056        Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException;
057    
058        /**
059         * Build a configuration from a local file
060         *
061         * @param inPlaceDeployment true if the deployment is in-place.
062         * @param plan the deployment plan
063         * @param module the module to build
064         * @param configurationStores
065         * @param artifactResolver
066         * @param targetConfigurationStore
067         * @return the deployment context created from the deployment (the contexts must be closed by the caller)
068         * @throws IOException if there was a problem reading or writing the files
069         * @throws org.apache.geronimo.common.DeploymentException if there was a problem with the configuration
070         */
071        DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, Object plan, JarFile module, Collection configurationStores, ArtifactResolver artifactResolver, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException;
072    }