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 import java.util.concurrent.TimeUnit; 025 026 import net.dpml.state.State; 027 028 /** 029 * Appliance interface. An appliance represents a component or component collection 030 * that can be comissioned and decommissioned. 031 * 032 * @author <a href="http://www.dpml.net">Digital Product Management Laboratory</a> 033 * @version 2.0.1 034 */ 035 public interface Appliance extends Remote 036 { 037 /** 038 * Return the current state of the instance. 039 * @return the current state 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 String getName() throws RemoteException; 077 078 String getCodebaseURI() throws RemoteException; 079 080 boolean isCommissioned() throws RemoteException; 081 } 082