001    /*
002     * Copyright 2006 Stephen J. McConnell.
003     *
004     * Licensed  under the  Apache License,  Version 2.0  (the "License");
005     * you may not use  this file  except in  compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *   http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed  under the  License is distributed on an "AS IS" BASIS,
012     * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
013     * implied.
014     *
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    
019    package net.dpml.lang;
020    
021    import java.io.IOException;
022    
023    import net.dpml.util.Resolver;
024    
025    import org.w3c.dom.Element;
026    
027    /**
028     * Interace implemented by part strategy handlers.
029     *
030     * @author <a href="http://www.dpml.net">Digital Product Management Library</a>
031     * @version 2.1.0
032     */
033    public interface StrategyHandler
034    {
035       /**
036        * Creation of a new strategy handler for the supplied implementation class.
037        * @param c the component implementation class
038        * @return a new strategy
039        * @exception IOException if an I/O error occurs
040        */
041        Strategy newStrategy( Class<?> c ) throws IOException;
042    
043       /**
044        * Creation of a new strategy handler for the supplied implementation class.
045        * @param c the component implementation class
046        * @param name the component name
047        * @return a new strategy
048        * @exception IOException if an I/O error occurs
049        */
050        Strategy newStrategy( Class<?> c, String name ) throws IOException;
051        
052       /**
053        * Construct a new strategy using a supplied element and value resolver.
054        * @param classloader the classloader
055        * @param element the DOM element definining the deployment strategy
056        * @param resolver symbolic property resolver
057        * @param partition the assigned partition
058        * @param query the query 
059        * @param validate if true validate the strategy integrity
060        * @return the strategy
061        * @exception IOException if an I/O error occurs
062        */
063        Strategy build( 
064          ClassLoader classloader, Element element, Resolver resolver, String partition, 
065          String query, boolean validate ) throws IOException;
066    }