001    /*
002     * Copyright 2004-2005 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.station;
020    
021    import java.rmi.Remote;
022    import java.rmi.RemoteException;
023    
024    import net.dpml.component.Provider;
025    
026    import net.dpml.lang.PID;
027    
028    import net.dpml.station.info.ApplicationDescriptor;
029    
030    /**
031     * Application process controller.
032     * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
033     * @version 1.2.0
034     */
035    public interface Application extends Remote
036    {
037       /**
038        * The default startup timeout in seconds.
039        */
040        public int DEFAULT_STARTUP_TIMEOUT = 6;
041    
042       /**
043        * The default shutdown timeout in seconds.
044        */
045        public int DEFAULT_SHUTDOWN_TIMEOUT = 6;
046    
047       /**
048        * Return the application id.
049        *
050        * @return the id
051        * @exception RemoteException if a remote error occurs
052        */
053        public String getID() throws RemoteException;
054        
055       /**
056        * Return the process identifier of the process within which the 
057        * application is running.
058        * @return the pid
059        * @exception RemoteException if a remote error occurs
060        */
061        PID getPID() throws RemoteException;
062    
063       /**
064        * Return the profile associated with this application 
065        * @return the application profile
066        * @exception RemoteException if a remote error occurs
067        */
068        ApplicationDescriptor getApplicationDescriptor() throws RemoteException;
069    
070       /**
071        * Return the current deployment state of the process.
072        * @return the current process state
073        * @exception RemoteException if a remote error occurs
074        */
075        ProcessState getProcessState() throws RemoteException;
076    
077       /**
078        * Start the application.
079        * @exception RemoteException if a remote error occurs
080        */
081        void start() throws RemoteException;
082    
083       /**
084        * Stop the application.
085        * @exception RemoteException if a remote error occurs
086        */
087        void stop() throws RemoteException;
088    
089       /**
090        * Restart the application.
091        * @exception RemoteException if a rmote error occurs
092        */
093        void restart() throws RemoteException;
094        
095       /**
096        * Return the component instance handler.
097        * @return the instance handler (possibly null)
098        * @exception RemoteException if a remote error occurs
099        */
100        Provider getProvider() throws RemoteException;
101    
102       /**
103        * Add an application listener.
104        * @param listener the listener to add
105        * @exception RemoteException if a remote error occurs
106        */
107        void addApplicationListener( ApplicationListener listener ) throws RemoteException;
108        
109       /**
110        * Remove an application listener.
111        * @param listener the listener to remove
112        * @exception RemoteException if a remote error occurs
113        */
114        void removeApplicationListener( ApplicationListener listener ) throws RemoteException;
115    }
116