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.appliance;
020    
021    import java.io.IOException;
022    import java.rmi.Remote;
023    import java.rmi.RemoteException;
024    
025    import net.dpml.state.State;
026    
027    /**
028     * Appliance interface.  An appliance represents a component or component collection
029     * that can be comissioned and decommissioned.
030     *
031     * @author <a href="http://www.dpml.net">Digital Product Management Library</a>
032     * @version 2.1.1
033     */
034    public interface Appliance extends Remote
035    {
036       /**
037        * Return the current state of the instance.
038        * @return the current state
039        * @exception RemoteException if a RMI remoting exception occurs
040        */
041        State getState() throws RemoteException;
042        
043       /**
044        * Add an appliance listener to the appliance.
045        * @param listener the appliance listener
046        * @exception RemoteException if a RMI error occurs
047        */
048        void addApplianceListener( ApplianceListener listener ) throws RemoteException;
049        
050       /**
051        * Remove an appliance listener from the appliance.
052        * @param listener the appliance listener
053        * @exception RemoteException if a RMI error occurs
054        */
055        void removeApplianceListener( ApplianceListener listener ) throws RemoteException;
056        
057       /**
058        * Commission the appliance.
059        * @exception IOException if a I/O error occurs
060        */
061        void commission() throws IOException;
062        
063       /**
064        * Decommission the appliance.
065        * @exception RemoteException if a RMI error occurs
066        */
067        void decommission() throws RemoteException;
068        
069       /**
070        * Return an array of subsidiary appliance instances managed by this appliance.
071        * @return an array of subsidiary appliance instances
072        * @exception RemoteException if a RMI error occurs
073        */
074        Appliance[] getChildren() throws RemoteException;
075      
076       /**
077        * Get the appliance name.
078        * @return the name
079        * @exception RemoteException if a RMI error occurs
080        */
081        String getName() throws RemoteException;
082        
083       /**
084        * Get the appliance codebase uri.
085        * @return the uri as a string
086        * @exception RemoteException if a RMI error occurs
087        */
088        String getCodebaseURI() throws RemoteException;
089        
090       /**
091        * Get the commissioned state of the appliance.
092        * @return TRUE if the appliance is commissioned
093        * @exception RemoteException if a RMI error occurs
094        */
095        boolean isCommissioned() throws RemoteException;
096    }
097