![]() ![]() |
![]() |
File: [Pegasus] / pegasus-JavaCIMClient / cimclient / tests / IndTests / myTestConsumer.java
(download)
Revision: 1.2, Thu Feb 12 18:12:28 2004 UTC (20 years, 4 months ago) by kumpf Branch: MAIN CVS Tags: pegasus25BeforeLicenseUpdate, SLPPERFINST-root, SLPPERFINST-branch, RELEASE_2_4_FC_CANDIDATE_1, RELEASE_2_4_1-BETA3, RELEASE_2_4_1-BETA2, RELEASE_2_4_1-BETA1, RELEASE_2_4_1, RELEASE_2_4_0-RC3, RELEASE_2_4_0-RC2, RELEASE_2_4_0, RELEASE_2_4-root, RELEASE_2_4-branch, PEP217_PRE_BRANCH, PEP217_POST_BRANCH, PEP217_BRANCH, PEP214ROOT, PEP214BRANCH, PEP214-root, PEP214-branch, PEP213_SIZE_OPTIMIZATIONS, PEP-214B-root, PEG25_IBM_5_16_05, MONITOR_CONSOLIDATION_2_5_BRANCH, IBM_241_April1405, HPUX_TEST, HEAD, CQL_2_5_BRANCH, CHUNKTESTDONE_PEP140, BUG2493_BINREP-root, BUG2493_BINREP-branch Changes since 1.1: +21 -11 lines HP-BAPU: PEP125 Enhancements to Pegasus Java Client and Java Listener |
// myTestConsumer.java // // The contents of this file are subject to the SNIA Public License Version 1.0 // (the "License"); you may not use this file except in compliance with the // License. You may obtain a copy of the License at // // http://www.snia.org/resources/openSource.html // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the // License for the specific language governing rights and limitations // under the License. // // The Initial Developers of the Original Code // Bapu Patil ( bapu_patil@hp.com) // Hewlett-Packard Company. // // Contributor(s): // // /** myTestConsumer.java This is a test program to receive Indications sent by Indication clients. This program start the CIM Indication Listener on port 8190. */ package tests.IndTests; import org.snia.wbem.client.*; import org.snia.wbem.cim.*; import org.snia.wbem.listener.*; import org.snia.wbemcmd.xml.*; import java.net.*; import java.util.*; public class myTestConsumer extends CIMHTTPListener { int proto=CIMClient.XML; String hostName="sequoia"; String nameSpace="root/cimv2"; int portNo=5988; String classText=""; String username="guest"; String password="guest"; String attachName=hostName; boolean cleanupOnly=false; boolean delete=true; CIMClient cc=null; CIMNameSpace clientNameSpace=null; boolean monitorMode=false; String localHostName=null; String sysCreationName="primary"; static final String FCCN="CIM_IndicationFilter"; static final String SCCN="CIM_IndicationSubscription"; myTestConsumer(int portNo, boolean isSSL) throws CIMException { super(portNo, isSSL); } private void handleIndication(CIMInstance ind, String indURL) { System.out.println("---------- Begin of event data ----------"); System.out.println("--- Indication URL : "+indURL); System.out.println("--- Indication : "+ind.toString()); try { Object o=null; if (ind.getClassName().startsWith("CIM_Class")) o=(Object)ind.getProperty("classdefinition").getValue().getValue(); if (ind.getClassName().startsWith("CIM_Inst")) o=(Object) ind.getProperty("sourceinstance").getValue().getValue(); if (o instanceof CIMInstance) { CIMInstance eo=(CIMInstance)o; System.out.println("--- Embedded Instance: "+eo); } else if (o instanceof CIMClass) { CIMClass eo=(CIMClass)o; System.out.println("--- Embedded Class: "+eo); } System.out.println("----------- End of event data -----------\n"); } catch (Exception ee) { ee.printStackTrace(); } } public void indicationOccured(CIMIndication e, String indURL) { handleIndication(e.getIndication(), indURL); } public static void main(String args[]) throws CIMException { boolean enableSSL=false; int listenerPortNo=8190; if ( args.length != 0 ) { if ( args[0].equals("-ssl") ) { System.out.println("SSL Enabled Indication Listener "); enableSSL = true; } } try { myTestConsumer myi= new myTestConsumer(listenerPortNo, enableSSL); myi.start(); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } System.out.println("Ok - waiting for events "); } }
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |