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.Component;
025
026 import net.dpml.lang.PID;
027
028 /**
029 * The Callback interface defines a service provider to a process through
030 * which the process may issue notification of state change.
031 *
032 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
033 * @version 1.2.0
034 */
035 public interface Callback extends Remote
036 {
037 /**
038 * Method invoked by a process to signal that the process has started.
039 *
040 * @param pid the process identifier
041 * @param handler optional handler reference
042 * @exception RemoteException if a remote error occurs
043 */
044 void started( PID pid, Component handler ) throws RemoteException;
045
046 /**
047 * Method invoked by a process to signal that the process has
048 * encounter an error condition.
049 *
050 * @param throwable the error condition
051 * @param fatal if true the process is requesting termination
052 * @exception RemoteException if a remote error occurs
053 */
054 void error( Throwable throwable, boolean fatal ) throws RemoteException;
055
056 /**
057 * Method invoked by a process to send a arbitary message to the
058 * the callback handler.
059 *
060 * @param message the message
061 * @exception RemoteException if a remote error occurs
062 */
063 void info( String message ) throws RemoteException;
064
065 /**
066 * Method invoked by a process to signal its imminent termination.
067 *
068 * @exception RemoteException if a remote error occurs
069 */
070 void stopped() throws RemoteException;
071
072 }
073