着信通信のシナリオ

以下のシナリオでは、フライト番号を入力として受け入れ、 そのフライトに関する情報を表示するホスト・アプリケーションを 想定します。このアプリケーションは ZIETrans RCP アプリケーションに変換されています。別の Eclipse RCP ベースのアプリケーションは、 フライト番号を含む予約情報を受け入れます。フライト番号がこのアプリケーションに入力されると、その番号は ZIETrans RCP アプリケーションに送信されます。これにより、そのフライト番号の情報で ZIETrans ビューが更新されます。このシナリオの コード例を以下に示します。
IServiceManager serviceManager = RcpRuntimePlugin.getDefault().getServiceManager();
IClientService clientService = serviceManager.getClientService(“theClientId”);
/*--------------------------------------------------------------------------------
// 
// Provides an example of a ZIETrans application receiving information from another 
// application.  This example cannot be executed directly but is provided to 
// highlight the approach required to achieve this functionality.
// 
// @param  Flight number from GUI as a Java String.  This value cannot be 
// <code>null</code>.
// 
*///------------------------------------------------------------------------------ 
    public void inboundToZIETransApplication( String flightNumber )
    {      
        // Save flight number from GUI
        Properties params = new Properties();
        
        params.setProperty( "fltNum",  flightNumber );

        // Get the service manager from singleton plug-in instance.
        IServiceManager serviceManager = 
                                RcpRuntimePlugin.getDefault().getServiceManager();

        // This will be the plug-in session we use to play our macro
        ISessionService aSessionService = null;

        // Find the correct ZIETrans plug-in session
        Collection sessionServices = 
                     serviceManager.retrieveServiceEntries( ServiceType.SESSION );
        Iterator itSessionServices = sessionServices.iterator();
        
        while ( itSessionServices.hasNext() )
        {
            aSessionService = (ISessionService) itSessionServices.next();

            // Assumes the first instance of the ZIETrans plug-in called "myApp" 
            // is the one we want.
            if ( "myApp".getApplicationId().equals( aSessionService ) )
            {
                break;
            }
        }

        // Refer to documentation to see how to launch an RCP plug-in instance if 
        // one is not already launched
        if ( aSessionService != null )
        {
            // Really should check the state in a limited-time loop, 
            // but let's assume we can go ahead
            if ( aSessionService.getSessionServiceState().isOperational() )
            {
                // Ask ZIETrans session service to play the macro with the fltNum 
                // from our GUI
                // Assumes that the macro can start from current screen or from 
                // the results screen.
                aSessionService.playMacro( "displayFlightInfo", params );
            }
        }
    }