ALMA Computing Group

MountSupplier.java

Go to the documentation of this file.
00001 /*
00002  *    ALMA - Atacama Large Millimiter Array
00003  *   (c) Associated Universities Inc., 2002 
00004  *   (c) European Southern Observatory, 2002
00005  *    Copyright by ESO (in the framework of the ALMA collaboration),
00006  *    All rights reserved
00007  *
00008  *    This library is free software; you can redistribute it and/or
00009  *    modify it under the terms of the GNU Lesser General Public
00010  *    License as published by the Free Software Foundation; either
00011  *    version 2.1 of the License, or (at your option) any later version.
00012  *
00013  *    This library is distributed in the hope that it will be useful,
00014  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  *    Lesser General Public License for more details.
00017  *
00018  *    You should have received a copy of the GNU Lesser General Public
00019  *    License along with this library; if not, write to the Free Software
00020  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00021  *    MA 02111-1307  USA
00022  *
00023  * MountSupplier.java
00024  *
00025  * Created on March 13, 2003, 11:43 AM
00026  */
00028 package alma.ACSCOURSE_MOUNT;
00030 import alma.acs.component.client.ComponentClient;
00031 import alma.acs.nc.SimpleSupplier;
00033 
00037 public class MountSupplier extends Thread
00038 {
00040 
00043     public static void main(String[] args)
00044         {
00045             try
00046                 {
00047                 //Setup an ACS Java client. This has little to do with the NC API
00048                 String managerLoc = System.getProperty("ACS.manager");
00049                 if (managerLoc == null)
00050                     {
00051                     System.out.println("Java property 'ACS.manager' must be set to the corbaloc of the ACS manager!");
00052                     System.exit(-1);
00053                     }
00054                 String clientName = "MountSupplierClient";
00055                 ComponentClient myClient = new ComponentClient(null, managerLoc, clientName);
00056 
00057                 //Create and initialize the supplier
00058                 SimpleSupplier joe = new SimpleSupplier(MOUNT_CHANNEL.value,  //the channel's name 
00059                                                         myClient.getContainerServices());  //type of event to be published
00060 
00061                 //Create the event that will be published
00062                 MountEventData t_block = new MountEventData(3.14F, 43.0F);
00063                 
00064                 //Publish the event 50 times int 50 seconds
00065                 System.out.println("Now sending events...");
00066                 for(int i=0; i<50; i++)
00067                     {                   
00068                     joe.publishEvent(t_block);
00069                     sleep(1000);
00070                     }
00071 
00072                 //Must cleanly disconnect the supplier
00073                 joe.disconnect();
00074 
00075                 //Must cleanly disconnect the client
00076                 myClient.tearDown();
00077                 }
00078             catch(Exception e)
00079                 {
00080                 e.printStackTrace(System.err);
00081                 }
00082     }
00084 }