001    /*
002     * Copyright (c) 2005-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.component;
020    
021    import java.io.IOException;
022    import java.lang.reflect.InvocationTargetException;
023    import java.rmi.Remote;
024    import java.rmi.RemoteException;
025    
026    /**
027     * The Component represents a remote interface to a runtime component type.
028     *
029     * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
030     * @version 1.0.4
031     */
032    public interface Component extends Remote, Commissionable
033    {
034       /**
035        * Return a provider of an instance of the component.
036        * @return the instance provider
037        * @exception InvocationTargetException if a target invocation error occurs
038        * @exception IOException if a IO error occurs
039        * @exception InvocationTargetException if a component invocation error occurs
040        */
041        Provider getProvider() throws IOException, InvocationTargetException;
042    
043       /**
044        * Return true if this handler is a candidate for the supplied service definition.
045        * @param service the service descriptor
046        * @return true if this is a candidate
047        * @exception RemoteException if a remote exception occurs
048        */
049        boolean isaCandidate( Service service ) throws RemoteException;
050        
051       /**
052        * Get the activation policy.  If the activation policy is STARTUP, an implementation
053        * a handler shall immidiately activation a runtime instance.  If the policy is on DEMAND
054        * an implementation shall defer activiation until an explicit request is received.  If 
055        * the policy if SYSTEM activation may occur at the discretion of an implementation.
056        *
057        * @return the activation policy
058        * @exception RemoteException if a remote exception occurs
059        * @see ActivationPolicy#SYSTEM
060        * @see ActivationPolicy#STARTUP
061        * @see ActivationPolicy#DEMAND
062        */
063        ActivationPolicy getActivationPolicy() throws RemoteException;
064        
065       /**
066        * Returns the commissioned status of the handler.
067        * @return TRUE if the handler has been commissioned otherwise FALSE
068        * @exception RemoteException if a remote exception occurs
069        */
070        boolean isActive() throws RemoteException;
071        
072       /**
073        * Return the number of instances currently under management.
074        * @return the instance count.
075        * @exception RemoteException if a remote exception occurs
076        */
077        int size() throws RemoteException;
078        
079    }
080