BUG#: 4577 TASK-PEP250_RPMProvider-merged_out_to_branch
authormark.hamzy <mark.hamzy>
Thu, 20 Apr 2006 15:55:19 +0000 (15:55 +0000)
committermark.hamzy <mark.hamzy>
Thu, 20 Apr 2006 15:55:19 +0000 (15:55 +0000)
TITLE: JMPI: All the functions under SelectExp.java retuens NULL

DESCRIPTION:
Added missing functionality and a testcase

23 files changed:
src/Pegasus/ProviderManager2/JMPI/JMPIImpl.cpp
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/CIMClass.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/CIMElement.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/CIMInstance.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/FromExp.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/JMPIQueryExp.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/JMPISelectList.java [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/Makefile
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/NonJoinExp.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/QueryExp.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/SelectExp.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/SelectList.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/WQLExp.java
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/JMPI_IndicationProvider.java [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/JMPI_IndicationProvider.mof [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/JMPI_IndicationProviderR.mof [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/Makefile [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndications.java [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndications.manifest [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndicationsListener.Makefile [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndicationsListener.cpp [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestWQL.Makefile [new file with mode: 0644]
src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestWQL.cpp [new file with mode: 0644]

index 71e21240ad45742309a8b51ba63c74503aa11106..03876ed6deef4376069bc065ccb3a36f74da27a7 100644 (file)
@@ -5005,6 +5005,12 @@ JNIEXPORT void JNICALL Java_org_pegasus_jmpi_CIMClient__1finalize
    DEBUG_ConvertCleanup (jint, jCc);
 }
 
+// -------------------------------------
+// ---
+// -           CIMObject
+// ---
+// -------------------------------------
+
 JNIEXPORT jint JNICALL Java_org_pegasus_jmpi_CIMObject__1newClass
   (JNIEnv *jEnv, jobject jThs, jobject jCc)
 {
@@ -5045,6 +5051,12 @@ JNIEXPORT void JNICALL Java_org_pegasus_jmpi_CIMObject__1finalize
    DEBUG_ConvertCleanup (jint, jInst);
 }
 
+// -------------------------------------
+// ---
+// -           OperationContext
+// ---
+// -------------------------------------
+
 /*
  * Class:     OperationContext
  * Method:    _get
@@ -5192,6 +5204,162 @@ JNIEXPORT jobject JNICALL Java_org_pegasus_jmpi_OperationContext__1get
    return jRet;
 }
 
+// -------------------------------------
+// ---
+// -           SelectExp
+// ---
+// -------------------------------------
+
+/*
+ * Class:     org_pegasus_jmpi_SelectExp
+ * Method:    _finalize
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_org_pegasus_jmpi_SelectExp__1finalize
+  (JNIEnv *jEnv, jobject jThs, jint jEselx)
+{
+   CMPI_SelectExp *eSelx = DEBUG_ConvertJavaToC (jint, CMPI_SelectExp*, jEselx);
+
+   delete eSelx;
+
+   DEBUG_ConvertCleanup (jint, eSelx);
+}
+
+/*
+ * Class:     org_pegasus_jmpi_SelectExp
+ * Method:    _newSelectExp
+ * Signature: (Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_org_pegasus_jmpi_SelectExp__1newSelectExp
+  (JNIEnv *jEnv, jobject jThs, jstring jQuery)
+{
+   const char         *pszQuery = jEnv->GetStringUTFChars (jQuery, NULL);
+   CMPI_SelectExp     *eSelx    = NULL;
+   WQLSelectStatement *stmt     = NULL;
+   String              queryLanguage (CALL_SIGN_WQL);
+   String              query (pszQuery);
+
+   stmt  = new WQLSelectStatement (queryLanguage, query);
+   eSelx = new CMPI_SelectExp (stmt);
+
+   jEnv->ReleaseStringUTFChars (jQuery, pszQuery);
+
+   return DEBUG_ConvertCToJava (CMPI_SelectExp *, jint, eSelx);
+}
+
+/*
+ * Class:     org_pegasus_jmpi_SelectExp
+ * Method:    _getSelectString
+ * Signature: (I)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_pegasus_jmpi_SelectExp__1getSelectString
+  (JNIEnv *jEnv, jobject jThs, jint jEselx)
+{
+   CMPI_SelectExp *eSelx = DEBUG_ConvertJavaToC (jint, CMPI_SelectExp*, jEselx);
+
+   return (jstring)jEnv->NewStringUTF (eSelx->cond.getCString ());
+}
+
+// -------------------------------------
+// ---
+// -           JMPISelectList
+// ---
+// -------------------------------------
+
+/*
+ * Class:     org_pegasus_jmpi_JMPISelectList
+ * Method:    _applyInstance
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_org_pegasus_jmpi_JMPISelectList__1applyInstance
+  (JNIEnv *jEnv, jobject jThs, jint jEselx, jint jciInstance)
+{
+   CMPI_SelectExp *eSelx = DEBUG_ConvertJavaToC (jint, CMPI_SelectExp*, jEselx);
+   CIMInstance    *ci    = DEBUG_ConvertJavaToC (jint, CIMInstance*, jciInstance);
+   CIMInstance    *ciRet = 0;
+
+   if (  !eSelx
+      || !eSelx->wql_stmt
+      )
+   {
+      return 0;
+   }
+
+   ciRet = new CIMInstance (ci->clone ());
+
+   if (ciRet)
+   {
+      eSelx->wql_stmt->applyProjection (*ciRet, false);
+   }
+
+   return DEBUG_ConvertCToJava (CIMInstance *, jint, ciRet);
+}
+
+/*
+ * Class:     org_pegasus_jmpi_JMPISelectList
+ * Method:    _applyClass
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_org_pegasus_jmpi_JMPISelectList__1applyClass
+  (JNIEnv *jEnv, jobject jThs, jint jEselx, jint jciClass)
+{
+   CMPI_SelectExp *eSelx = DEBUG_ConvertJavaToC (jint, CMPI_SelectExp*, jEselx);
+   CIMClass       *cc    = DEBUG_ConvertJavaToC (jint, CIMClass*, jciClass);
+   CIMClass       *ccRet = NULL;
+
+   if (  !eSelx
+      || !eSelx->wql_stmt
+      )
+   {
+      return 0;
+   }
+
+   if (cc)
+   {
+      CIMObject co (cc->clone ());
+
+      eSelx->wql_stmt->applyProjection (co, false);
+
+      ccRet = new CIMClass (co);
+
+      return DEBUG_ConvertCToJava (CIMClass *, jint, ccRet);
+   }
+
+   return 0;
+}
+
+// -------------------------------------
+// ---
+// -           JMPIQueryExp
+// ---
+// -------------------------------------
+
+/*
+ * Class:     org_pegasus_jmpi_JMPIQueryExp
+ * Method:    _applyInstance
+ * Signature: (II)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_pegasus_jmpi_JMPIQueryExp__1applyInstance
+  (JNIEnv *jEnv, jobject jThs, jint jEselx, jint jciInstance)
+{
+   CMPI_SelectExp *eSelx = DEBUG_ConvertJavaToC (jint, CMPI_SelectExp*, jEselx);
+   CIMInstance    *ci    = DEBUG_ConvertJavaToC (jint, CIMInstance*, jciInstance);
+
+   if (  !eSelx
+      || !eSelx->wql_stmt
+      )
+   {
+      return 0;
+   }
+
+   if (eSelx->wql_stmt)
+   {
+      return eSelx->wql_stmt->evaluate (*ci);
+   }
+
+   return false;
+}
+
 } // extern "C"
 
 PEGASUS_NAMESPACE_END
index a6c1f6cfbc9bad048a485ab62035a3f13cadd89e..4dcb12f3e982318ee8475eb77e06d94d6b5763f6 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 //
 //==============================================================================
 //
-// Author:      Adrian Schuur, schuur@de.ibm.com 
+// Author:      Adrian Schuur, schuur@de.ibm.com
 //
 // Modified By: Adrian Duta
 //              Magda
 //              Andy
+//              Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
-
-
 package org.pegasus.jmpi;
 
 import java.util.Vector;
@@ -79,7 +78,7 @@ public class CIMClass implements CIMElement
       cInst=ci;
    }
 
-   int cInst() {
+   public int cInst() {
       return cInst;
    }
 
index a81ab936af92f958786136ebc12244b8a9898e6a..e3f1467da3e331375330b93612b6227ae5f5f58e 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 //
 // Author:      Adrian Schuur, schuur@de.ibm.com
 //
-// Modified By:
+// Modified By: Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
-
-
 package org.pegasus.jmpi;
 
+public interface CIMElement
+{
+    public int    cInst     ();
+    public String getName   ();
+    public void   setName   (String     iname);
+    public String toString  ();
 
-public interface CIMElement  {
-
-    public String getName();
-    public void setName(String iname);
-    public String toString();
-
-    //public boolean equals(Object rhs);
-    //public boolean lessThan(CIMElement rhs);
+////public boolean equals   (Object     rhs);
+////public boolean lessThan (CIMElement rhs);
 }
index 0ee50fefaed4256b0949ec047e24962cd6766fea..780eb7a76a131c34f0697307c3c5eb6e5db8224e 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
@@ -32,6 +32,7 @@
 // Author:      Adrian Schuur, schuur@de.ibm.com
 //
 // Modified By: Adrian Duta
+//              Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
 package org.pegasus.jmpi;
@@ -72,7 +73,7 @@ public class CIMInstance implements CIMElement {
         cInst=ci;
     }
 
-    int cInst () {
+    public int cInst () {
         return cInst;
     }
 
@@ -232,4 +233,4 @@ public class CIMInstance implements CIMElement {
     static {
        System.loadLibrary("JMPIProviderManager");
     }
-};
+}
index f0472d198e3d98115659c307aa616ae5f74dc615..e5f100b80b68eb7d9a978fc3938ae9f4610751f3 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 //
 // Author:      Adrian Schuur, schuur@de.ibm.com
 //
-// Modified By:
+// Modified By: Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
-
-
 package org.pegasus.jmpi;
 
-
-public abstract class FromExp {
-};
-
+abstract public class FromExp
+{
+}
index 12a404b0974d30ea1da382823247fa8e70167174..8f885453ed8806b85c86ed0ab52464bee8368475 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 //
 // Author:      Adrian Schuur, schuur@de.ibm.com
 //
-// Modified By: Mark Hamzy, hamzy@us.ibm.com
+// Modified By: Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
 package org.pegasus.jmpi;
 
-import java.util.*;
-
-public class JMPIQueryExp extends QueryExp {
-
-   int cInst;
+import java.util.List;
 
-   private native void _finalize (int cInst);
+public class JMPIQueryExp
+             extends QueryExp
+{
+   private int ciSelectExp;
 
-   protected void finalize ()
-   {
-      _finalize (cInst);
-   }
+   private native boolean _applyInstance (int ciSelectExp, int ciInstance);
 
-   JMPIQueryExp (int ci)
+   JMPIQueryExp (int ciSelectExp)
    {
-     cInst=ci;
+      this.ciSelectExp = ciSelectExp;
    }
 
-   public boolean apply (CIMElement  old)
+   public boolean apply (CIMElement elm)
+      throws CIMException
    {
-      return false;
+      if (elm instanceof CIMInstance)
+      {
+         return _applyInstance (ciSelectExp, elm.cInst ());
+      }
+      else if (elm instanceof CIMClass)
+      {
+         throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);
+      }
+      else
+      {
+         throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);
+      }
    }
 
    public List canonizeDOC ()
@@ -72,4 +80,4 @@ public class JMPIQueryExp extends QueryExp {
    static {
       System.loadLibrary("JMPIProviderManager");
    }
-};
+}
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/JMPISelectList.java b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/JMPISelectList.java
new file mode 100644 (file)
index 0000000..a752e1d
--- /dev/null
@@ -0,0 +1,94 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+// Author:      Mark Hamzy,    hamzy@us.ibm.com
+//
+// Modified By: Mark Hamzy,    hamzy@us.ibm.com
+//
+//%/////////////////////////////////////////////////////////////////////////////
+package org.pegasus.jmpi;
+
+import java.util.Enumeration;
+
+public class JMPISelectList
+             extends SelectList
+{
+   private int ciSelectExp;
+
+   private native int _applyInstance (int ciSelectExp, int ciInstance);
+   private native int _applyClass    (int ciSelectExp, int ciClass);
+
+   JMPISelectList (int ciSelectExp)
+   {
+      this.ciSelectExp = ciSelectExp;
+   }
+
+///public void addElement (AttributeExp ae)
+///{
+///}
+
+   public Enumeration elements ()
+   {
+      return null;
+   }
+
+   public CIMElement apply (CIMElement elm)
+   {
+      if (elm instanceof CIMInstance)
+      {
+         int ciInst = 0;
+
+         ciInst = _applyInstance (ciSelectExp, elm.cInst ());
+
+         if (ciInst != 0)
+         {
+            return new CIMInstance (ciInst);
+         }
+      }
+      else if (elm instanceof CIMClass)
+      {
+         int ciClass = 0;
+
+         ciClass = _applyClass (ciSelectExp, elm.cInst ());
+
+         if (ciClass != 0)
+         {
+            return new CIMClass (ciClass);
+         }
+      }
+
+      return null;
+   }
+
+   static {
+      System.loadLibrary("JMPIProviderManager");
+   }
+}
index 1f1c146cd866413e888a3b3d2b8ce99d50074092..ad89abc5aee84e146ceaf638b0dcb1b3011e4c52 100644 (file)
@@ -89,6 +89,7 @@ PACKAGEDIR = org/pegasus/jmpi
    FromExp.class \
    NonJoinExp.class \
    SelectList.class \
+   JMPISelectList.class \
    QueryExp.class \
    JMPIQueryExp.class \
    WQLExp.class \
index 3a07608d885ea7ab9d56a54cf110987979c9415c..eef1cddd9d161fa1fdeda0129129c56cd5de701f 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 //
 // Author:      Adrian Schuur, schuur@de.ibm.com
 //
-// Modified By:
+// Modified By: Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
-
-
 package org.pegasus.jmpi;
 
+public class NonJoinExp
+             extends FromExp
+{
+///public QualifiedAttributeExp getAttribute ()
+///{
+///   return table;
+///}
 
-public class NonJoinExp extends FromExp {
-//   public QualifiedAttributeExp getAttribute() {
-//      return table;
-//   }
-   public String getTableName() {
+   // ???
+   public String getTableName ()
+   {
       return null;
    }
-   public String toString() {
+
+   public String toString ()
+   {
       return null;
    }
-};
-
+}
index fa6896da62cc614206857310295c3f739fd18039..cc62d3288bc2d94eafd1a23e2affd0bd26a18161 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 //
 // Author:      Adrian Schuur, schuur@de.ibm.com
 //
-// Modified By:
+// Modified By: Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
-
-
 package org.pegasus.jmpi;
 
-import java.util.*;
-
-
-public abstract class QueryExp {
-   public boolean apply(CIMElement  old)
-   {
-      return false;
-   }
-
-   public List canonizeDOC()
-   {
-      return null;
-   }
-
-   public List canonizeCOD()
-   {
-      return null;
-   }
-
-};
-
+import java.util.List;
 
+public abstract class QueryExp
+{
+   public abstract boolean apply       (CIMElement elm)
+      throws CIMException;
+   public abstract List    canonizeDOC ();
+   public abstract List    canonizeCOD ();
+}
index 774fc3a6c7b79ec3a0ca4d5a89a7c272e1af2a31..3b6d3043bc83a9651ce1e742db2796d6fcaf8545 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 //
 // Author:      Adrian Schuur, schuur@de.ibm.com
 //
-// Modified By: Mark Hamzy, hamzy@us.ibm.com
+// Modified By: Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
 package org.pegasus.jmpi;
 
-public class SelectExp extends WQLExp {
-
-   int cInst;
+public class SelectExp
+             extends WQLExp
+{
+   private int cInst;
 
-   private native void   _finalize (int cInst);
+   private native void   _finalize        (int    cInst);
+   private native int    _newSelectExp    (String query);
+   private native String _getSelectString (int    cInst);
 
    protected void finalize ()
    {
-      _finalize(cInst);
+      _finalize (cInst);
+   }
+
+   protected SelectExp (int ci)
+   {
+      cInst = ci;
    }
 
-   SelectExp (int ci)
+   public SelectExp (String query)
    {
-     cInst=ci;
+      cInst = _newSelectExp (query);
    }
 
    public String getSelectString ()
    {
-      return null;
+      return _getSelectString (cInst);
    }
 
    public QueryExp getWhereClause ()
    {
-      return null;
+      return new JMPIQueryExp (cInst);
    }
 
    public SelectList getSelectList ()
    {
-      return null;
+      return new JMPISelectList (cInst);
    }
 
    public FromExp getFromClause ()
@@ -73,6 +81,6 @@ public class SelectExp extends WQLExp {
    }
 
    static {
-      System.loadLibrary("JMPIProviderManager");
+      System.loadLibrary ("JMPIProviderManager");
    }
-};
+}
index 5c73de75e884eb7efb2393d79ce095e6414ae3b9..7f6de5b8b5dad31555a51e74c6d481f6f31f92d0 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 //
 // Author:      Adrian Schuur, schuur@de.ibm.com
 //
-// Modified By: Mark Hamzy, hamzy@us.ibm.com
+// Modified By: Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
 package org.pegasus.jmpi;
 
-import java.util.*;
-
-public class SelectList {
-
-   int cInst;
-
-   private native void   _finalize (int cInst);
-
-   protected void finalize ()
-   {
-      _finalize(cInst);
-   }
-
-   SelectList (int ci)
-   {
-     cInst=ci;
-   }
-
-///public void addAttr (AttributeExp ae)
-///{
-///}
-
-   public Enumeration elements ()
-   {
-      return null;
-   }
-
-   public CIMElement apply (CIMElement ce)
-   {
-      return null;
-   }
+import java.util.Enumeration;
 
-   static {
-      System.loadLibrary("JMPIProviderManager");
-   }
-};
+public abstract class SelectList
+{
+///public abstract void        addElement (AttributeExp ae);
+   public abstract Enumeration elements   ();
+   public abstract CIMElement  apply      (CIMElement   elm);
+}
index 5502555689582e80af9b4459d73e6d4fe9b5988c..24039880d365b712f0e69a77a010f3e8b3b84694 100644 (file)
@@ -17,7 +17,7 @@
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // sell copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
-// 
+//
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 //
 // Author:      Adrian Schuur, schuur@de.ibm.com
 //
-// Modified By:
+// Modified By: Mark Hamzy,    hamzy@us.ibm.com
 //
 //%/////////////////////////////////////////////////////////////////////////////
-
-
 package org.pegasus.jmpi;
 
-
-class WQLExp {
-   public WQLExp() {
-   }
-};
-
+abstract class WQLExp
+{
+}
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/JMPI_IndicationProvider.java b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/JMPI_IndicationProvider.java
new file mode 100644 (file)
index 0000000..85377f3
--- /dev/null
@@ -0,0 +1,498 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+// Author:      Mark Hamzy, IBM (hamzy@us.ibm.com)
+//
+// Modified By: Mark Hamzy, IBM (hamzy@us.ibm.com)
+//
+//%/////////////////////////////////////////////////////////////////////////////
+package org.pegasus.jmpi.tests.Indication;
+
+import java.util.Vector;
+import org.pegasus.jmpi.CIMClass;
+import org.pegasus.jmpi.CIMDataType;
+import org.pegasus.jmpi.CIMException;
+import org.pegasus.jmpi.CIMInstance;
+import org.pegasus.jmpi.CIMOMHandle;
+import org.pegasus.jmpi.CIMObjectPath;
+import org.pegasus.jmpi.CIMProperty;
+import org.pegasus.jmpi.CIMValue;
+import org.pegasus.jmpi.EventProvider2;
+import org.pegasus.jmpi.InstanceProvider2;
+import org.pegasus.jmpi.MethodProvider2;
+import org.pegasus.jmpi.OperationContext;
+import org.pegasus.jmpi.SelectExp;
+import org.pegasus.jmpi.SelectList;
+import org.pegasus.jmpi.NonJoinExp;
+import org.pegasus.jmpi.QueryExp;
+import org.pegasus.jmpi.UnsignedInt32;
+import org.pegasus.jmpi.UnsignedInt64;
+
+public class JMPI_IndicationProvider
+             implements InstanceProvider2,
+                        MethodProvider2,
+                        EventProvider2
+{
+   private static String CLASSNAME = "TestIndication";
+   private static String NAMESPACE = "test/static";
+   private CIMOMHandle   ch        = null;
+   private Vector        paths     = new Vector ();
+   private Vector        instances = new Vector ();
+
+   public void initialize (CIMOMHandle ch)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::initialize: ch = " + ch);
+
+      this.ch = ch;
+   }
+
+   public void cleanup ()
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::cleanup");
+
+      ch        = null;
+      paths     = null;
+      instances = null;
+   }
+
+   public CIMObjectPath createInstance (OperationContext oc,
+                                        CIMObjectPath    cop,
+                                        CIMInstance      cimInstance)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::createInstance: oc          = " + oc);
+      System.out.println ("JMPI_IndicationProvider::createInstance: cop         = " + cop);
+// @HACK
+String nameSpaceCop = cop.getNameSpace ();
+cop = new CIMObjectPath (cimInstance.getClassName (),
+                         cimInstance.getKeyValuePairs ());
+cop.setNameSpace (nameSpaceCop);
+System.out.println ("JMPI_IndicationProvider::createInstance: cop         = " + cop);
+      System.out.println ("JMPI_IndicationProvider::createInstance: cimInstance = " + cimInstance);
+
+      // Ensure the Namespace is valid
+      if (!cop.getNameSpace ().equalsIgnoreCase (NAMESPACE))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);
+
+      // Ensure the class existing in the specified namespace
+      if (!cop.getObjectName ().equalsIgnoreCase (CLASSNAME))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);
+
+      // Ensure that all of the properties exists in the instance
+      if (  cimInstance.getProperty ("InstanceId") == null
+         || cimInstance.getProperty ("PropertyString") == null
+         )
+         throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);
+
+      // Ensure that all of the key properties exists in the object path
+      if (cop.getKeyValue ("InstanceId") == null)
+         throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);
+
+      // Ensure the requested object do not exist
+      if (findObjectPath (cop) >= 0)
+         throw new CIMException (CIMException.CIM_ERR_ALREADY_EXISTS);
+
+      paths.addElement (cop);
+      instances.addElement (cimInstance);
+
+      return cop;
+   }
+
+   public CIMInstance getInstance (OperationContext oc,
+                                   CIMObjectPath    cop,
+                                   CIMClass         cimClass,
+                                   boolean          includeQualifiers,
+                                   boolean          includeClassOrigin,
+                                   String           propertyList[])
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::getInstance: oc                 = " + oc);
+      System.out.println ("JMPI_IndicationProvider::getInstance: cop                = " + cop);
+      System.out.println ("JMPI_IndicationProvider::getInstance: cimClass           = " + cimClass);
+      System.out.println ("JMPI_IndicationProvider::getInstance: includeQualifiers  = " + includeQualifiers);
+      System.out.println ("JMPI_IndicationProvider::getInstance: includeClassOrigin = " + includeClassOrigin);
+      System.out.println ("JMPI_IndicationProvider::getInstance: propertyList       = " + propertyList);
+
+      // ensure the InstanceId key is valid
+      Vector keys = cop.getKeys ();
+      int    i;
+
+      for (i = 0;
+           i < keys.size () && ! ((CIMProperty)keys.elementAt (i)).getName ().equalsIgnoreCase ("InstanceId");
+           i++)
+      {
+      }
+
+      if (i == keys.size ())
+         throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);
+
+      // ensure the Namespace is valid
+      if (!cop.getNameSpace ().equalsIgnoreCase (NAMESPACE))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);
+
+      // ensure the class existing in the specified namespace
+      if (!cop.getObjectName ().equalsIgnoreCase (CLASSNAME))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);
+
+      // ensure the request object exists
+      int index = findObjectPath (cop);
+
+      if (index < 0)
+         throw new CIMException (CIMException.CIM_ERR_NOT_FOUND);
+
+      return (CIMInstance)instances.elementAt (index);
+   }
+
+   public void setInstance (OperationContext oc,
+                            CIMObjectPath    cop,
+                            CIMInstance      cimInstance)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::setInstance: oc          = " + oc);
+      System.out.println ("JMPI_IndicationProvider::setInstance: cop         = " + cop);
+      System.out.println ("JMPI_IndicationProvider::setInstance: cimInstance = " + cimInstance);
+
+      // ensure the Namespace is valid
+      if (!cop.getNameSpace ().equalsIgnoreCase (NAMESPACE))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);
+
+      // ensure the class existing in the specified namespace
+      if (!cop.getObjectName ().equalsIgnoreCase (CLASSNAME))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);
+
+      // ensure the request object exists
+      int index = findObjectPath (cop);
+
+      if (index < 0)
+         throw new CIMException (CIMException.CIM_ERR_NOT_FOUND);
+   }
+
+   public void deleteInstance (OperationContext oc,
+                               CIMObjectPath    cop)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::deleteInstance: oc  = " + oc);
+      System.out.println ("JMPI_IndicationProvider::deleteInstance: cop = " + cop);
+
+      // ensure the Namespace is valid
+      if (!cop.getNameSpace ().equalsIgnoreCase (NAMESPACE))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);
+
+      // ensure the class existing in the specified namespace
+      if (!cop.getObjectName ().equalsIgnoreCase (CLASSNAME))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);
+
+      // ensure the request object exists
+      int index = findObjectPath (cop);
+
+      if (index < 0)
+         throw new CIMException (CIMException.CIM_ERR_NOT_FOUND);
+   }
+
+   public Vector enumerateInstanceNames (OperationContext oc,
+                                         CIMObjectPath    cop,
+                                         CIMClass         cimClass)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::enumerateInstanceNames: oc       = " + oc);
+      System.out.println ("JMPI_IndicationProvider::enumerateInstanceNames: cop      = " + cop);
+      System.out.println ("JMPI_IndicationProvider::enumerateInstanceNames: cimClass = " + cimClass);
+
+      // ensure the Namespace is valid
+      if (!cop.getNameSpace ().equalsIgnoreCase (NAMESPACE))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);
+
+      // ensure the class existing in the specified namespace
+      if (!cop.getObjectName ().equalsIgnoreCase (CLASSNAME))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);
+
+      return paths;
+   }
+
+   public Vector enumerateInstances (OperationContext oc,
+                                     CIMObjectPath    cop,
+                                     CIMClass         cimClass,
+                                     boolean          includeQualifiers,
+                                     boolean          includeClassOrigin,
+                                     String           propertyList[])
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::enumerateInstances: oc                 = " + oc);
+      System.out.println ("JMPI_IndicationProvider::enumerateInstances: cop                = " + cop);
+      System.out.println ("JMPI_IndicationProvider::enumerateInstances: cimClass           = " + cimClass);
+      System.out.println ("JMPI_IndicationProvider::enumerateInstances: includeQualifiers  = " + includeQualifiers);
+      System.out.println ("JMPI_IndicationProvider::enumerateInstances: includeClassOrigin = " + includeClassOrigin);
+      System.out.println ("JMPI_IndicationProvider::enumerateInstances: propertyList       = " + propertyList);
+
+      // ensure the Namespace is valid
+      if (!cop.getNameSpace ().equalsIgnoreCase (NAMESPACE))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);
+
+      // ensure the class existing in the specified namespace
+      if (!cop.getObjectName ().equalsIgnoreCase (CLASSNAME))
+         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);
+
+      return instances;
+   }
+
+   public Vector execQuery (OperationContext oc,
+                            CIMObjectPath    cop,
+                            CIMClass         cimClass,
+                            String           queryStatement,
+                            String           queryLanguage)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::execQuery: oc             = " + oc);
+      System.out.println ("JMPI_IndicationProvider::execQuery: cop            = " + cop);
+      System.out.println ("JMPI_IndicationProvider::execQuery: cimClass       = " + cimClass);
+      System.out.println ("JMPI_IndicationProvider::execQuery: queryStatement = " + queryStatement);
+      System.out.println ("JMPI_IndicationProvider::execQuery: queryLanguage  = " + queryLanguage);
+
+      if (!queryLanguage.equals ("WQL"))
+      {
+         throw new CIMException (CIMException.CIM_ERR_NOT_SUPPORTED);
+      }
+
+      SelectExp     q         = new SelectExp (queryStatement);
+      SelectList    attrs     = q.getSelectList ();
+      NonJoinExp    from      = (NonJoinExp)q.getFromClause ();
+      QueryExp      where     = q.getWhereClause ();
+      Vector        instances = enumerateInstances (oc,
+                                                    cop,
+                                                    cimClass,
+                                                    true,
+                                                    true,
+                                                    null);
+      Vector        ret       = new Vector ();
+
+      // filter the instances
+      for (int i = 0; i < instances.size (); i++)
+      {
+         if (  where == null
+            || where.apply ((CIMInstance)instances.elementAt (i))
+            )
+         {
+            ret.addElement (attrs.apply ((CIMInstance)instances.elementAt (i)));
+         }
+      }
+
+      return ret;
+   }
+
+   public CIMValue invokeMethod (OperationContext oc,
+                                 CIMObjectPath    cop,
+                                 String           methodName,
+                                 Vector           inArgs,
+                                 Vector           outArgs)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::invokeMethod: oc         = " + oc);
+      System.out.println ("JMPI_IndicationProvider::invokeMethod: cop        = " + cop);
+      System.out.println ("JMPI_IndicationProvider::invokeMethod: methodName = " + methodName);
+      System.out.println ("JMPI_IndicationProvider::invokeMethod: inArgs     = " + inArgs);
+      System.out.println ("JMPI_IndicationProvider::invokeMethod: outArgs    = " + outArgs);
+
+      // ensure the Namespace is valid
+      if (!cop.getNameSpace ().equalsIgnoreCase (NAMESPACE))
+      {
+         throw new CIMException (CIMException.CIM_ERR_INVALID_NAMESPACE);
+      }
+
+      // ensure the class existing in the specified namespace
+      if (!cop.getObjectName ().equalsIgnoreCase (CLASSNAME))
+      {
+         throw new CIMException (CIMException.CIM_ERR_INVALID_CLASS);
+      }
+
+      if (methodName.equalsIgnoreCase ("SendTestIndicationNormal"))
+      {
+         if (inArgs == null)
+         {
+            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);
+         }
+         else if (inArgs.size () != 1)
+         {
+            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);
+         }
+
+         CIMProperty cp = (CIMProperty)inArgs.elementAt (0);
+
+         if (!cp.getName ().equalsIgnoreCase ("indicationSendCount"))
+         {
+            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);
+         }
+         else if (cp.getType ().getType () != CIMDataType.UINT64)
+         {
+            throw new CIMException (CIMException.CIM_ERR_INVALID_PARAMETER);
+         }
+
+         CIMValue      cvIndicationSendCount = cp.getValue ();
+         UnsignedInt64 uiIndicationSendCount = (UnsignedInt64)cvIndicationSendCount.getValue ();
+
+         System.out.println ("JMPI_IndicationProvider::invokeMethod: uiIndicationSendCount = " + uiIndicationSendCount);
+
+         CIMClass      ccIndication;
+         CIMInstance   ciIndication;
+         CIMObjectPath copIndication;
+
+         ccIndication = ch.getClass (cop,
+                                     true,
+                                     true,
+                                     true,
+                                     null);
+         ciIndication = ccIndication.newInstance ();
+
+         ciIndication.setProperty ("InstanceId", new CIMValue (uiIndicationSendCount));
+         ciIndication.setProperty ("PropertyString", new CIMValue ("Hello"));
+
+         copIndication = createInstance (oc,
+                                         cop,
+                                         ciIndication);
+
+         System.out.println ("JMPI_IndicationProvider::invokeMethod: deliverEvent: copIndication = " + copIndication);
+         System.out.println ("JMPI_IndicationProvider::invokeMethod: deliverEvent: ciIndication  = " + ciIndication);
+
+         ch.deliverEvent (copIndication.getNameSpace (),
+                          ciIndication);
+
+         return new CIMValue (new UnsignedInt32 ("0"));
+      }
+      else
+      {
+         throw new CIMException (CIMException.CIM_ERR_METHOD_NOT_AVAILABLE);
+      }
+   }
+
+   public void authorizeFilter (OperationContext oc,
+                                SelectExp        filter,
+                                String           eventType,
+                                CIMObjectPath    classPath,
+                                String           owner)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::authorizeFilter: oc        = " + oc);
+      System.out.println ("JMPI_IndicationProvider::authorizeFilter: filter    = " + filter);
+      System.out.println ("JMPI_IndicationProvider::authorizeFilter: eventType = " + eventType);
+      System.out.println ("JMPI_IndicationProvider::authorizeFilter: classPath = " + classPath);
+      System.out.println ("JMPI_IndicationProvider::authorizeFilter: owner     = " + owner);
+
+      if (filter != null)
+      {
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getSelectString () = " + filter.getSelectString ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getWhereClause ()  = " + filter.getWhereClause ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getSelectList ()   = " + filter.getSelectList ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getFromClause ()   = " + filter.getFromClause ());
+      }
+   }
+
+   public boolean mustPoll (OperationContext oc,
+                            SelectExp        filter,
+                            String           eventType,
+                            CIMObjectPath    classPath)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::mustPoll: oc        = " + oc);
+      System.out.println ("JMPI_IndicationProvider::mustPoll: filter    = " + filter);
+      System.out.println ("JMPI_IndicationProvider::mustPoll: eventType = " + eventType);
+      System.out.println ("JMPI_IndicationProvider::mustPoll: classPath = " + classPath);
+
+      if (filter != null)
+      {
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getSelectString () = " + filter.getSelectString ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getWhereClause ()  = " + filter.getWhereClause ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getSelectList ()   = " + filter.getSelectList ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getFromClause ()   = " + filter.getFromClause ());
+      }
+
+      return false;
+   }
+
+   public void activateFilter (OperationContext oc,
+                               SelectExp        filter,
+                               String           eventType,
+                               CIMObjectPath    classPath,
+                               boolean          firstActivation)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::activateFilter: oc              = " + oc);
+      System.out.println ("JMPI_IndicationProvider::activateFilter: filter          = " + filter);
+      System.out.println ("JMPI_IndicationProvider::activateFilter: eventType       = " + eventType);
+      System.out.println ("JMPI_IndicationProvider::activateFilter: classPath       = " + classPath);
+      System.out.println ("JMPI_IndicationProvider::activateFilter: firstActivation = " + firstActivation);
+
+      if (filter != null)
+      {
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getSelectString () = " + filter.getSelectString ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getWhereClause ()  = " + filter.getWhereClause ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getSelectList ()   = " + filter.getSelectList ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getFromClause ()   = " + filter.getFromClause ());
+      }
+   }
+
+   public void deActivateFilter (OperationContext oc,
+                                 SelectExp        filter,
+                                 String           eventType,
+                                 CIMObjectPath    classPath,
+                                 boolean          lastActivation)
+      throws CIMException
+   {
+      System.out.println ("JMPI_IndicationProvider::deActivateFilter: oc             = " + oc);
+      System.out.println ("JMPI_IndicationProvider::deActivateFilter: filter         = " + filter);
+      System.out.println ("JMPI_IndicationProvider::deActivateFilter: eventType      = " + eventType);
+      System.out.println ("JMPI_IndicationProvider::deActivateFilter: classPath      = " + classPath);
+      System.out.println ("JMPI_IndicationProvider::deActivateFilter: lastActivation = " + lastActivation);
+
+      if (filter != null)
+      {
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getSelectString () = " + filter.getSelectString ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getWhereClause ()  = " + filter.getWhereClause ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getSelectList ()   = " + filter.getSelectList ());
+         System.out.println ("JMPI_IndicationProvider::activateFilter: filter.getFromClause ()   = " + filter.getFromClause ());
+      }
+   }
+
+   private int findObjectPath (CIMObjectPath path)
+   {
+      String p = path.toString ();
+
+      for (int i = 0; i < paths.size (); i++)
+      {
+         System.out.println ("testing " + paths.elementAt (i) + " against " + path);
+
+         if (((CIMObjectPath)paths.elementAt (i)).toString ().equalsIgnoreCase (p))
+            return i;
+      }
+
+      return -1;
+   }
+}
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/JMPI_IndicationProvider.mof b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/JMPI_IndicationProvider.mof
new file mode 100644 (file)
index 0000000..6bd5127
--- /dev/null
@@ -0,0 +1,53 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+
+// ==================================================================
+// TestIndication
+// ==================================================================
+
+[Version ("2.2.0"), Description (""), provider("JMPI_IndicationProvider")]
+class TestIndication : CIM_Indication
+{
+// [Key, MaxLen (256), Description ("CreationClassName indicates the name of the class or the "
+//                                  "subclass used in the creation of an instance. When used "
+//                                  "with the other key properties of this class, this property "
+//                                  "allows all instances of this class and its subclasses to "
+//                                  "be uniquely identified.")]
+// string CreationClassName;
+
+   [Key, Description ("An identifier that uniquely identifies each instance of the TestIndication hierarchy.") ]
+   uint64 InstanceId;
+
+   [Maxlen (256), Description ("a string property of TestIndication")]
+   string PropertyString;
+
+   uint32 SendTestIndicationNormal (uint64 indicationSendCount);
+};
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/JMPI_IndicationProviderR.mof b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/JMPI_IndicationProviderR.mof
new file mode 100644 (file)
index 0000000..ac26268
--- /dev/null
@@ -0,0 +1,60 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+
+instance of PG_ProviderModule
+{
+   Name             = "JMPI_IndicationProviderModule";
+   Location         = "JMPI_IndicationProvider.jar:org/pegasus/jmpi/tests/Indication/JMPI_IndicationProvider";
+   Vendor           = "OpenPegasus";
+   Version          = "2.0.0";
+   InterfaceType    = "JMPIExperimental";
+   InterfaceVersion = "0.0.1";
+};
+
+instance of PG_Provider
+{
+   ProviderModuleName = "JMPI_IndicationProviderModule";
+   Name               = "JMPI_IndicationProvider";
+};
+
+instance of PG_ProviderCapabilities
+{
+   ProviderModuleName  = "JMPI_IndicationProviderModule";
+   ProviderName        = "JMPI_IndicationProvider";
+   CapabilityID        = "1";
+   ClassName           = "TestIndication";
+   Namespaces          = {"test/static"};
+   // ValueMap {"2",        "3",           "4" ,          "5" ,     "6" ,                 "7"},
+   // Values   {"Instance", "Association", "Indication" , "Method", "IndicationConsumer", "InstanceQuery"}]
+   ProviderType        = { 2, 4, 5 };
+   SupportedProperties = NULL;     // All properties
+   SupportedMethods    = NULL;     // All methods
+};
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/Makefile b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/Makefile
new file mode 100644 (file)
index 0000000..a11efaa
--- /dev/null
@@ -0,0 +1,86 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#//
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+JAVAROOT = ../../../../..
+ROOT     = ../../../../../../../../..
+DIR      = Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication
+
+include $(ROOT)/mak/config.mak
+include $(ROOT)/mak/configschema.mak
+
+.SUFFIXES: .java .class .jar .cpp
+
+.java.class:
+       javac -classpath $(JAVAROOT) $*.java
+
+STATICTESTNS=test/static
+STATICTESTNSDIRECTORY=$(REPOSITORY_ROOT)/test\#static
+
+PACKAGEDIR = org/pegasus/jmpi/tests/Indication/
+
+JAR1         = $(PEGASUS_HOME)/lib/JMPI_IndicationProvider.jar
+JAR1CLASSES  = \
+       JMPI_IndicationProvider.class
+JAR2         = $(PEGASUS_HOME)/lib/JMPI_IndicationClient.jar
+JAR2CLASSES  = \
+       TestIndications.class
+JAR2MANIFEST = TestIndications.manifest
+
+PFXCLASSES   = $(addprefix -C ../../../../.. $(PACKAGEDIR),$(CLASSES))
+
+LOCAL_CLEAN_TARGET = $(JAR1CLASSES) $(JAR2CLASSES) $(JAR1) $(JAR2)
+
+all build: $(JAR1) $(JAR2)
+       $(MAKE) -f TestIndicationsListener.Makefile
+
+depend:
+
+clean:
+       $(RM) $(JAR1CLASSES) $(JAR2CLASSES)
+       $(RM) $(JAR1) $(JAR2)
+       $(MAKE) -f TestIndicationsListener.Makefile clean
+
+repository:
+       @$(ECHO) +++++ Loading CIM_Core$(CIM_SCHEMA_VER) into $(STATICTESTNS) namespace ...
+       @cimmofl "-R$(REPOSITORY_DIR)" "-N$(REPOSITORY_NAME)" "-M$(REPOSITORY_MODE)" "-I$(CIM_SCHEMA_DIR)" "-n$(STATICTESTNS)" $(ALLOW_EXPERIMENTAL) $(CIM_SCHEMA_DIR)/CIM_Core$(CIM_SCHEMA_VER).mof
+       @$(ECHO) +++++ Loading CIM_Event$(CIM_SCHEMA_VER) into $(STATICTESTNS) namespace ...
+       @cimmofl "-R$(REPOSITORY_DIR)" "-N$(REPOSITORY_NAME)" "-M$(REPOSITORY_MODE)" "-I$(CIM_SCHEMA_DIR)" "-n$(STATICTESTNS)" $(ALLOW_EXPERIMENTAL) $(CIM_SCHEMA_DIR)/CIM_Event$(CIM_SCHEMA_VER).mof
+       @$(ECHO) +++++ Loading $(JAR) into $(STATICTESTNS) namespace ...
+       @cimmofl "-R$(REPOSITORY_DIR)" "-N$(REPOSITORY_NAME)" "-M$(REPOSITORY_MODE)" -I. "-n$(STATICTESTNS)" JMPI_IndicationProvider.mof
+       @cimmofl "-R$(REPOSITORY_DIR)" "-N$(REPOSITORY_NAME)" "-M$(REPOSITORY_MODE)" -I. "-n$(INTEROPNS)" JMPI_IndicationProviderR.mof
+
+poststarttests: $(JAR1) $(JAR2)
+       java -jar $(JAR2) debug
+
+$(JAR1): $(JAR1CLASSES)
+       jar -cf $@ $(addprefix -C ../../../../.. $(PACKAGEDIR),$(JAR1CLASSES))
+
+$(JAR2): $(JAR2CLASSES)
+       jar -cfm $@ $(JAR2MANIFEST) $(addprefix -C ../../../../.. $(PACKAGEDIR),$(JAR2CLASSES))
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndications.java b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndications.java
new file mode 100644 (file)
index 0000000..f68260c
--- /dev/null
@@ -0,0 +1,845 @@
+//%2006////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation, The Open Group.
+// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; VERITAS Software Corporation; The Open Group.
+// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+// EMC Corporation; Symantec Corporation; The Open Group.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+// Author:      Mark Hamzy, IBM (hamzy@us.ibm.com)
+//
+// Modified By: Mark Hamzy, IBM (hamzy@us.ibm.com)
+//
+//%/////////////////////////////////////////////////////////////////////////////
+package org.pegasus.jmpi.tests.Indication;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.pegasus.jmpi.CIMClass;
+import org.pegasus.jmpi.CIMClient;
+import org.pegasus.jmpi.CIMException;
+import org.pegasus.jmpi.CIMInstance;
+import org.pegasus.jmpi.CIMNameSpace;
+import org.pegasus.jmpi.CIMObjectPath;
+import org.pegasus.jmpi.CIMProperty;
+import org.pegasus.jmpi.CIMValue;
+import org.pegasus.jmpi.UnsignedInt16;
+import org.pegasus.jmpi.UnsignedInt32;
+import org.pegasus.jmpi.UnsignedInt64;
+
+public class TestIndications
+{
+   private final static String className        = "TestIndication";
+   private final static String nameSpaceClass   = "test/static";
+   private final static String nameSpaceInterOp = "root/PG_InterOp";
+   private final static String nameSpaceCIMV2   = "root/cimv2";
+   private final static String hostName         = "localhost";
+
+   private static boolean      fDebug           = false;
+   private static int          iNumIndications  = 10;
+   private static boolean      fDelete          = true;
+
+   public void setDebug (boolean fNewDebug)
+   {
+       fDebug = fNewDebug;
+   }
+
+   private static CIMObjectPath createInstance (CIMClient   cc,
+                                                CIMInstance ciToCreate,
+                                                String      nameSpace)
+      throws Exception
+   {
+      CIMObjectPath copToCreate   = null;
+      Vector        keyValuePairs = null;
+      CIMInstance   ciToReturn    = null;
+      CIMObjectPath copToReturn   = null;
+
+      try
+      {
+         if (fDebug)
+         {
+            System.err.println ("TestIndications::createInstance: ciToCreate = " + ciToCreate);
+         }
+
+         keyValuePairs = ciToCreate.getKeyValuePairs ();
+
+         if (fDebug)
+         {
+            System.err.println ("TestIndications::createInstance: keyValuePairs = " + keyValuePairs);
+         }
+
+         if (keyValuePairs.size () == 0)
+         {
+////////////@BUG
+////////////throw new Exception ("No keys returned for " + ciToCreate.getClassName ());
+
+            keyValuePairs = ciToCreate.getProperties ();
+
+            if (fDebug)
+            {
+               System.err.println ("TestIndications::createInstance: no keyValuePairs returned.  switching to keyValuePairs = " + keyValuePairs);
+            }
+
+            for (int i = 0; i < keyValuePairs.size (); i++)
+            {
+               CIMProperty cp = (CIMProperty)keyValuePairs.elementAt (i);
+               CIMValue    cv = cp.getValue ();
+               System.err.println (cv.isArray ());
+            }
+         }
+
+/////////@BUG
+/////////copToCreate = new CIMObjectPath (ciToCreate,
+/////////                                 nameSpace);
+
+         copToCreate = new CIMObjectPath (ciToCreate.getClassName (),
+                                          keyValuePairs);
+
+         copToCreate.setNameSpace (nameSpace);
+
+         if (fDebug)
+         {
+            System.err.println ("TestIndications::createInstance: copToCreate = " + copToCreate);
+         }
+
+         cc.createInstance (copToCreate,
+                            ciToCreate);
+      }
+      catch (CIMException e)
+      {
+         if (e.getID ().equals ("CIM_ERR_ALREADY_EXISTS"))
+         {
+            if (fDebug)
+            {
+               System.err.println ("TestIndications::createInstance: Instance already exists calling getInstance (" + copToCreate + ")");
+            }
+         }
+         else
+         {
+            if (fDebug)
+            {
+               System.err.println ("TestIndications::createInstance: Caught " + e);
+            }
+
+            throw e;
+         }
+      }
+
+      ciToReturn = cc.getInstance (copToCreate,
+                                   false);
+
+      keyValuePairs = ciToReturn.getKeyValuePairs ();
+      if (keyValuePairs.size () == 0)
+      {
+         keyValuePairs = ciToReturn.getProperties ();
+      }
+
+      copToReturn = new CIMObjectPath (ciToReturn.getClassName (),
+                                       keyValuePairs);
+
+      copToReturn.setNameSpace (nameSpace);
+
+      return copToReturn;
+   }
+
+   private static String getHostname ()
+   {
+      try
+      {
+         InetAddress addr = InetAddress.getLocalHost ();
+
+         // Get IP Address
+         byte[] ipAddr = addr.getAddress ();
+
+         // Get hostname
+         return addr.getHostName ();
+      }
+      catch (UnknownHostException e)
+      {
+      }
+
+      return "localhost";
+   }
+
+   private static UnsignedInt64 findNextIndicationNumber (CIMClient cc)
+      throws CIMException
+   {
+      for (int i = 1; i < 1000; i++)
+      {
+         UnsignedInt64 ui64ToTry = new UnsignedInt64 (new Integer (i).toString ());
+         try
+         {
+            CIMObjectPath copInstance   = null;
+            CIMInstance   ciIndication  = null;
+            Vector        keyValuePairs = new Vector ();
+
+            keyValuePairs.addElement (new CIMProperty ("InstanceId",
+                                                       new CIMValue (ui64ToTry)));
+
+            copInstance = new CIMObjectPath (className,
+                                             keyValuePairs);
+            copInstance.setNameSpace (nameSpaceClass);
+
+            ciIndication = cc.getInstance (copInstance,
+                                           false);
+         }
+         catch (CIMException e)
+         {
+            if (e.getID ().equals ("CIM_ERR_NOT_FOUND"))
+            {
+               return ui64ToTry;
+            }
+            else if (!e.getID ().equals ("CIM_ERR_ALREADY_EXISTS"))
+            {
+               throw e;
+            }
+         }
+      }
+
+      return new UnsignedInt64 ("1000");
+   }
+
+   private static CIMObjectPath testCreateClassIndicationFilter (CIMClient cc)
+      throws Exception
+   {
+      CIMClass      ccFilter  = cc.getClass (new CIMObjectPath ("CIM_IndicationFilter",
+                                                                nameSpaceInterOp),
+                                             false);
+      CIMInstance   ciFilter  = ccFilter.newInstance ();
+      CIMObjectPath copFilter = null;
+
+      ciFilter.setProperty ("CreationClassName",
+                            new CIMValue ("CIM_IndicationFilter"));
+      ciFilter.setProperty ("SystemCreationClassName",
+                            new CIMValue ("CIM_ComputerSystem"));
+      ciFilter.setProperty ("Name",
+                            new CIMValue ("classCreationFilter"));
+      ciFilter.setProperty ("SystemName", new CIMValue (getHostname ()));
+      ciFilter.setProperty ("SourceNamespace", new CIMValue (nameSpaceClass));
+      ciFilter.setProperty ("Query",
+                            new CIMValue ("SELECT * FROM TestIndication"));
+//////                      new CIMValue ("SELECT * FROM CIM_ClassCreation WHERE ClassDefinition ISA " + className));
+      ciFilter.setProperty ("QueryLanguage",
+                            new CIMValue ("DMTF:CQL"));
+
+      try
+      {
+         copFilter = createInstance (cc,
+                                     ciFilter,
+                                     nameSpaceInterOp);
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("TestIndications::testCreateClassIndicationFilter: Exception: " + e);
+
+            e.printStackTrace ();
+         }
+      }
+
+      if (fDebug)
+      {
+         System.err.println ("TestIndications::testCreateClassIndicationFilter: copFilter = " + copFilter);
+      }
+
+      if (copFilter != null)
+      {
+         System.out.println ("SUCCESS: testCreateClassIndicationFilter");
+      }
+      else
+      {
+         System.out.println ("FAIL: testCreateClassIndicationFilter");
+      }
+
+      return copFilter;
+   }
+
+   private static CIMObjectPath testCreateClassIndicationHandler (CIMClient cc)
+      throws Exception
+   {
+      CIMClass      ccHandler  = null;
+      CIMInstance   ciHandler  = null;
+      CIMObjectPath copHandler = null;
+
+      if (true)
+      {
+         // CIM_IndicationHandlerCIMXML
+         ccHandler = cc.getClass (new CIMObjectPath ("CIM_IndicationHandlerCIMXML",
+                                                     nameSpaceInterOp),
+                                  false);
+         ciHandler = ccHandler.newInstance ();
+
+         ciHandler.setProperty ("CreationClassName",
+                                new CIMValue ("CIM_IndicationHandlerCIMXML"));
+         ciHandler.setProperty ("SystemName", new CIMValue (getHostname ()));
+         ciHandler.setProperty ("Destination", new CIMValue ("http://localhost:2005/CIMListener/Pegasus_SimpleDisplayConsumer"));
+      }
+      else if (false)
+      {
+         // CIM_ListenerDestinationCIMXML
+      }
+      else if (false)
+      {
+         // PG_IndicationHandlerSNMPMapper
+      }
+      else if (false)
+      {
+         // PG_ListenerDestinationSystemLog
+         ccHandler = cc.getClass (new CIMObjectPath ("PG_ListenerDestinationSystemLog",
+                                                     nameSpaceInterOp),
+                                  false);
+         ciHandler = ccHandler.newInstance ();
+
+         ciHandler.setProperty ("CreationClassName",
+                                new CIMValue ("PG_ListenerDestinationSystemLog"));
+
+         // returns: CIM_ERR_NOT_SUPPORTED (CIM_ERR_NOT_SUPPORTED: The requested operation is not supported: "The specified class is not served by the Indication Service")
+      }
+      else if (false)
+      {
+         // PG_ListenerDestinationEmail
+         ccHandler = cc.getClass (new CIMObjectPath ("PG_ListenerDestinationEmail",
+                                                     nameSpaceInterOp),
+                                  false);
+         ciHandler = ccHandler.newInstance ();
+
+         ciHandler.setProperty ("CreationClassName",
+                                new CIMValue ("PG_ListenerDestinationEmail"));
+
+         Vector vectorMailTo = new Vector ();
+
+         vectorMailTo.addElement ("root@localhost");
+
+         ciHandler.setProperty ("MailTo",
+                                new CIMValue (vectorMailTo));
+
+         ciHandler.setProperty ("MailSubject",
+                                new CIMValue ("Hello Indication"));
+
+         // terminate called after throwing an instance of 'Pegasus::TypeMismatchException'
+      }
+
+      ciHandler.setProperty ("Name",
+                             new CIMValue ("classCreationHandler"));
+      ciHandler.setProperty ("SystemCreationClassName",
+                             new CIMValue ("CIM_ComputerSystem"));
+
+      try
+      {
+         copHandler = createInstance (cc,
+                                      ciHandler,
+                                      nameSpaceInterOp);
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("TestIndications::testCreateClassIndicationHandler: Exception: " + e);
+
+            e.printStackTrace ();
+         }
+      }
+
+      if (fDebug)
+      {
+         System.err.println ("TestIndications::testCreateClassIndicationHandler: copHandler = " + copHandler);
+      }
+
+      if (copHandler != null)
+      {
+         System.out.println ("SUCCESS: testCreateClassIndicationHandler");
+      }
+      else
+      {
+         System.out.println ("FAIL: testCreateClassIndicationHandler");
+      }
+
+      return copHandler;
+   }
+
+   private static CIMObjectPath testCreateClassIndicationSubscription (CIMClient     cc,
+                                                                       CIMObjectPath copFilter,
+                                                                       CIMObjectPath copHandler)
+      throws Exception
+   {
+      CIMClass      ccSubscription  = cc.getClass (new CIMObjectPath ("CIM_IndicationSubscription",
+                                                                      nameSpaceInterOp),
+                                                   false);
+      CIMInstance   ciSubscription  = ccSubscription.newInstance ();
+      CIMObjectPath copSubscription = null;
+
+      ciSubscription.setProperty ("Filter", new CIMValue (copFilter));
+      ciSubscription.setProperty ("Handler", new CIMValue (copHandler));
+      ciSubscription.setProperty ("SubscriptionState", new CIMValue (new UnsignedInt16 ("2")));
+
+      try
+      {
+         copSubscription = createInstance (cc,
+                                           ciSubscription,
+                                           nameSpaceInterOp);
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("TestIndications::testCreateClassIndicationHandler: Exception: " + e);
+
+            e.printStackTrace ();
+         }
+      }
+
+      if (fDebug)
+      {
+         System.err.println ("TestIndications::testCreateClassIndicationHandler: copSubscription = " + copSubscription);
+      }
+
+      if (copSubscription != null)
+      {
+         System.out.println ("SUCCESS: testCreateClassIndicationSubscription");
+      }
+      else
+      {
+         System.out.println ("FAIL: testCreateClassIndicationSubscription");
+      }
+
+      return copSubscription;
+   }
+
+   private static boolean testCreateIndication (CIMClient cc,
+                                                int       iInstanceId)
+      throws Exception
+   {
+      CIMObjectPath copTestIndication    = new CIMObjectPath (className,
+                                                              nameSpaceClass);
+      String        methodName           = "SendTestIndicationNormal";
+      UnsignedInt64 ui64IndicationNumber = findNextIndicationNumber (cc);
+      Vector        inArgs               = new Vector ();
+      Vector        outArgs              = new Vector ();
+      CIMValue      cvRet                = null;
+
+      inArgs.addElement (new CIMProperty ("indicationSendCount",
+                                          new CIMValue (ui64IndicationNumber)));
+
+      if (fDebug)
+      {
+         System.err.println ("TestIndications::testCreateIndication: Calling " + methodName + " (" + inArgs + ", " + outArgs + ")");
+      }
+
+      try
+      {
+         cvRet = cc.invokeMethod (copTestIndication,
+                                  methodName,
+                                  inArgs,
+                                  outArgs);
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("Caught " + e);
+            e.printStackTrace ();
+         }
+      }
+
+      if (cvRet == null)
+      {
+         System.out.println ("FAIL: testCreateIndication: ret == null");
+
+         return false;
+      }
+      else if (((UnsignedInt32)cvRet.getValue ()).intValue () != 0)
+      {
+         System.out.println ("FAIL: testCreateIndication: ret (" + cvRet.getValue () + ") != 0");
+
+         return false;
+      }
+      else
+      {
+         System.out.println ("SUCCESS: testCreateIndication (" + ui64IndicationNumber + ")");
+
+         return true;
+      }
+   }
+
+   private static boolean testExecQueryIndication (CIMClient cc)
+   {
+      CIMObjectPath copTestIndication  = new CIMObjectPath (className,
+                                                            nameSpaceClass);
+      Enumeration   enum               = null;
+      int           iInstancesReturned = 0;
+
+      try
+      {
+         enum = cc.execQuery (copTestIndication,
+                              "SELECT InstanceId FROM TestIndication WHERE InstanceId = 1",
+                              "WQL");
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("Caught " + e);
+            e.printStackTrace ();
+         }
+      }
+
+      if (enum == null)
+      {
+         System.out.println ("FAIL: testExecQueryIndication: enum == null");
+
+         return false;
+      }
+
+      if (fDebug)
+      {
+         System.err.println ("enum.hasMoreElements () = " + enum.hasMoreElements ());
+      }
+
+      while (enum.hasMoreElements ())
+      {
+         CIMInstance elm = (CIMInstance)enum.nextElement ();
+
+         if (fDebug)
+         {
+            System.err.println ("elm = " + elm);
+         }
+
+         iInstancesReturned++;
+      }
+
+      if (iInstancesReturned == 1)
+      {
+         System.out.println ("SUCCESS: testExecQueryIndication");
+      }
+      else
+      {
+         System.out.println ("FAIL: testExecQueryIndication iInstancesReturned != 1 (" + iInstancesReturned + ")");
+
+         return false;
+      }
+
+      iInstancesReturned = 0;
+
+      try
+      {
+         enum = cc.execQuery (copTestIndication,
+                              "SELECT InstanceId FROM TestIndication WHERE InstanceId <= 5",
+                              "WQL");
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("Caught " + e);
+            e.printStackTrace ();
+         }
+      }
+
+      if (enum == null)
+      {
+         System.out.println ("FAIL: testExecQueryIndication: enum == null");
+
+         return false;
+      }
+
+      if (fDebug)
+      {
+         System.err.println ("enum.hasMoreElements () = " + enum.hasMoreElements ());
+      }
+
+      while (enum.hasMoreElements ())
+      {
+         CIMInstance elm = (CIMInstance)enum.nextElement ();
+
+         if (fDebug)
+         {
+            System.err.println ("elm = " + elm);
+         }
+
+         iInstancesReturned++;
+      }
+
+      if (iInstancesReturned == 5)
+      {
+         System.out.println ("SUCCESS: testExecQueryIndication");
+      }
+      else
+      {
+         System.out.println ("FAIL: testExecQueryIndication iInstancesReturned != 5 (" + iInstancesReturned + ")");
+
+         return false;
+      }
+
+      return true;
+   }
+
+   private static boolean testDeleteClassIndicationSubscription (CIMClient     cc,
+                                                                 CIMObjectPath copSubscription)
+   {
+      try
+      {
+         cc.deleteInstance (copSubscription);
+
+         System.out.println ("SUCCESS: testDeleteClassIndicationSubscription");
+
+         return true;
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("Caught " + e);
+            e.printStackTrace ();
+         }
+      }
+
+      System.out.println ("FAIL: testDeleteClassIndicationSubscription");
+
+      return false;
+   }
+
+   private static boolean testDeleteClassIndicationHandler (CIMClient     cc,
+                                                            CIMObjectPath copHandler)
+   {
+      try
+      {
+         cc.deleteInstance (copHandler);
+
+         System.out.println ("SUCCESS: testDeleteClassIndicationHandler");
+
+         return true;
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("Caught " + e);
+            e.printStackTrace ();
+         }
+      }
+
+      System.out.println ("FAIL: testDeleteClassIndicationHandler");
+
+      return false;
+   }
+
+   private static boolean testDeleteClassIndicationFilter (CIMClient     cc,
+                                                           CIMObjectPath copFilter)
+   {
+      try
+      {
+         cc.deleteInstance (copFilter);
+
+         System.out.println ("SUCCESS: testDeleteClassIndicationFilter");
+
+         return true;
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("Caught " + e);
+            e.printStackTrace ();
+         }
+      }
+
+      System.out.println ("FAIL: testDeleteClassIndicationFilter");
+
+      return false;
+   }
+
+   private static boolean runTests (CIMClient cc)
+      throws Exception
+   {
+      CIMObjectPath copFilter       = null;
+      CIMObjectPath copHandler      = null;
+      CIMObjectPath copSubscription = null;
+
+      copFilter = testCreateClassIndicationFilter (cc);
+
+      if (copFilter == null)
+      {
+         return false;
+      }
+
+      copHandler = testCreateClassIndicationHandler (cc);
+
+      if (copFilter == null)
+      {
+         return false;
+      }
+
+      copSubscription = testCreateClassIndicationSubscription (cc, copFilter, copHandler);
+
+      if (copSubscription == null)
+      {
+         return false;
+      }
+
+      for (int i = 1; i <= iNumIndications; i++)
+      {
+         if (!testCreateIndication (cc, i))
+         {
+            return false;
+         }
+      }
+
+      testExecQueryIndication (cc);
+
+      if (fDelete)
+      {
+         if (!testDeleteClassIndicationSubscription (cc, copSubscription))
+         {
+            return false;
+         }
+
+         if (!testDeleteClassIndicationHandler (cc, copHandler))
+         {
+            return false;
+         }
+
+         if (!testDeleteClassIndicationFilter (cc, copFilter))
+         {
+            return false;
+         }
+      }
+
+      return true;
+   }
+
+   public static void main (String[] args)
+   {
+      CIMClient cimClient = null;
+
+      for (int i = 0; i < args.length; i++)
+      {
+         if (args[i].equalsIgnoreCase ("debug"))
+         {
+            fDebug = true;
+         }
+         else if (args[i].equalsIgnoreCase ("noDebug"))
+         {
+            fDebug = false;
+         }
+         else if (args[i].equalsIgnoreCase ("numIndications"))
+         {
+            if (i + 1 < args.length)
+            {
+               iNumIndications = new Integer (args[i+1]).intValue ();
+
+               i++;
+            }
+         }
+         else if (args[i].equalsIgnoreCase ("delete"))
+         {
+            fDelete = true;
+         }
+         else if (args[i].equalsIgnoreCase ("noDelete"))
+         {
+            fDelete = false;
+         }
+      }
+
+      try
+      {
+         int          portNo          = 5988;
+         String       username        = "";
+         String       password        = "";
+         String       urlAttach       = "http://" + hostName + ":" + portNo;
+         CIMNameSpace clientNameSpace = null;
+
+         clientNameSpace = new CIMNameSpace (urlAttach, nameSpaceInterOp);
+         if (clientNameSpace == null)
+         {
+            System.err.println ("Error: Could not create a CIMNameSpace ('" + urlAttach + "', '" + nameSpaceInterOp + "');");
+            System.exit (1);
+         }
+
+         try
+         {
+            cimClient = new CIMClient (clientNameSpace, username, password);
+         }
+         catch (Exception e)
+         {
+            if (fDebug)
+            {
+               System.err.println ("Caught " + e);
+               e.printStackTrace ();
+            }
+         }
+         if (cimClient == null)
+         {
+            System.err.println ("Error: Could not create a CIMClient ('" + clientNameSpace + "', '" + username + "', '" + password + "');");
+            System.exit (1);
+         }
+
+         if (fDebug)
+         {
+            System.err.println ("cimClient    = " + cimClient);
+         }
+
+         runTests (cimClient);
+      }
+      catch (CIMException e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("Error: CIMException: " + e);
+
+            e.printStackTrace ();
+         }
+      }
+      catch (Exception e)
+      {
+         if (fDebug)
+         {
+            System.err.println ("Error: Exception: " + e);
+            e.printStackTrace ();
+         }
+      }
+      finally
+      {
+         if (cimClient != null)
+         {
+            try
+            {
+               cimClient.close ();
+            }
+            catch (CIMException e)
+            {
+               if (fDebug)
+               {
+                  System.err.println ("Error: CIMException: " + e);
+                  e.printStackTrace ();
+               }
+            }
+         }
+      }
+   }
+}
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndications.manifest b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndications.manifest
new file mode 100644 (file)
index 0000000..91090d3
--- /dev/null
@@ -0,0 +1,3 @@
+Main-Class: org.pegasus.jmpi.tests.Indication.TestIndications
+Class-Path: JMPIImpl.jar
+
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndicationsListener.Makefile b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndicationsListener.Makefile
new file mode 100644 (file)
index 0000000..f74996e
--- /dev/null
@@ -0,0 +1,51 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#//
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+ROOT = $(PEGASUS_ROOT)
+DIR  = Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication
+
+include $(ROOT)/mak/config.mak
+
+PROGRAM            = TestIndicationsListener
+SOURCES            = TestIndicationsListener.cpp
+EXTRA_CXX_FLAGS    =
+LOCAL_DEFINES      =
+SYS_INCLUDES       =
+EXTRA_INCLUDES     =
+EXTRA_LINK_FLAGS   =
+LIBRARIES          = \
+       peglistener \
+       pegclient \
+       pegexportserver \
+       pegcommon
+LOCAL_CLEAN_TARGET =
+
+include $(ROOT)/mak/program.mak
+include $(ROOT)/mak/test.mak
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndicationsListener.cpp b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestIndicationsListener.cpp
new file mode 100644 (file)
index 0000000..da6a443
--- /dev/null
@@ -0,0 +1,89 @@
+#include <Pegasus/Consumer/CIMIndicationConsumer.h>
+#include <Pegasus/Listener/CIMListener.h>
+
+PEGASUS_USING_PEGASUS;
+PEGASUS_USING_STD;
+
+class MyIndicationConsumer : public CIMIndicationConsumer
+{
+public:
+    MyIndicationConsumer ()
+    {
+    }
+
+    ~MyIndicationConsumer ()
+    {
+    }
+
+    void consumeIndication (const OperationContext& context,
+                            const String&           url,
+                            const CIMInstance&      indicationInstance)
+    {
+       Uint32 ui32Index  = indicationInstance.findProperty ("InstanceId");
+       Uint64 ui64Number = 0;
+
+       if (ui32Index != PEG_NOT_FOUND)
+       {
+          try
+          {
+             indicationInstance.getProperty (ui32Index).getValue ().get (ui64Number);
+          }
+          catch (Exception& e)
+          {
+          }
+       }
+
+       cout << "! "
+            << url
+            << " ! "
+            << indicationInstance.getClassName ().getString ()
+            << " ! "
+            << ui64Number
+            << endl;
+    }
+
+private:
+};
+
+int main (int argc, char *argv[])
+{
+   Uint32                portNumber            = 2005;
+   CIMListener           listener (portNumber);
+   MyIndicationConsumer *consumer              = new MyIndicationConsumer ();
+
+   // Add our consumer
+   listener.addConsumer (consumer);
+
+   // Finish starting the CIMListener
+   try
+   {
+       cout << "+++++ Starting the CIMListener at destination\n"
+            << "       http://localhost:2005/TestIndicationStressTest"
+            << endl;
+
+       // Start the listener
+       listener.start ();
+   }
+   catch (BindFailedException &bfe)
+   {
+       // Got a bind error.  The port is probably already in use.
+       // Put out a message and fail.
+       cerr << endl
+            << "==>WARNING: unable to bind to listener port 2005"
+            << endl;
+       cerr << "The listener port may be in use." << endl;
+
+       throw;
+   }
+
+   cout << "Press any key to terminate..." << endl;
+
+   cin.get ();
+
+   listener.stop ();
+   listener.removeConsumer (consumer);
+
+   delete consumer;
+
+   return 0;
+}
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestWQL.Makefile b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestWQL.Makefile
new file mode 100644 (file)
index 0000000..e97abe7
--- /dev/null
@@ -0,0 +1,50 @@
+#//%2006////////////////////////////////////////////////////////////////////////
+#//
+#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
+#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
+#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation, The Open Group.
+#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
+#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; VERITAS Software Corporation; The Open Group.
+#// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
+#// EMC Corporation; Symantec Corporation; The Open Group.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a copy
+#// of this software and associated documentation files (the "Software"), to
+#// deal in the Software without restriction, including without limitation the
+#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#// sell copies of the Software, and to permit persons to whom the Software is
+#// furnished to do so, subject to the following conditions:
+#//
+#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
+#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
+#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//==============================================================================
+ROOT = $(PEGASUS_ROOT)
+DIR  = Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication
+
+include $(ROOT)/mak/config.mak
+
+PROGRAM            = TestWQL
+SOURCES            = TestWQL.cpp
+EXTRA_CXX_FLAGS    =
+LOCAL_DEFINES      =
+SYS_INCLUDES       =
+EXTRA_INCLUDES     =
+EXTRA_LINK_FLAGS   =
+LIBRARIES          = \
+       pegwql \
+       pegclient \
+       pegcommon
+LOCAL_CLEAN_TARGET =
+
+include $(ROOT)/mak/program.mak
+include $(ROOT)/mak/test.mak
diff --git a/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestWQL.cpp b/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/Indication/TestWQL.cpp
new file mode 100644 (file)
index 0000000..e6b666b
--- /dev/null
@@ -0,0 +1,108 @@
+#include <Pegasus/Client/CIMClient.h>
+#include <Pegasus/WQL/WQLSelectStatement.h>
+#include <Pegasus/WQL/WQLParser.h>
+
+#include <iostream>
+
+PEGASUS_USING_PEGASUS;
+PEGASUS_USING_STD;
+
+int
+main (int argc, char *argv[])
+{
+   CIMClient client;
+
+   try
+   {
+      client.connectLocal ();
+   }
+   catch (const Exception &e)
+   {
+      cerr << "Caught: " << e.getMessage () << endl;
+   }
+
+   Array<CIMInstance> instances;
+
+   try
+   {
+      instances = client.enumerateInstances (CIMNamespaceName ("root/cimv2"),
+                                             CIMName ("PG_UnixProcess"),
+                                             true,                          // deepInheritance
+                                             false,                         // localOnly
+                                             false,                         // includeQualifiers
+                                             true);                         // includeClassOrigin
+
+      cout << "instances.size () = " << instances.size () << endl;
+   }
+   catch (const Exception &e)
+   {
+      cerr << "Caught: " << e.getMessage () << endl;
+   }
+
+   String              queryLanguage = "WQL";
+   String              query         = "SELECT CSName, OSName FROM PG_UnixProcess WHERE Handle = \"2037\"";
+   WQLSelectStatement *stmt          = new WQLSelectStatement (queryLanguage, query);
+
+   try
+   {
+      WQLParser::parse (query, *stmt);
+   }
+   catch (const Exception &e)
+   {
+      cerr << "Caught: " << e.getMessage () << endl;
+   }
+
+   cout << "stmt->getQueryLanguage () " << stmt->getQueryLanguage () << endl;
+   cout << "stmt->getQuery () " << stmt->getQuery () << endl;
+   cout << "stmt->getAllProperties () " << stmt->getAllProperties () << endl;
+
+   // public String getSelectString ()
+
+   CIMPropertyList cplSelect = stmt->getSelectPropertyList ();
+
+   cout << "cplSelect.size () = " << cplSelect.size () << endl;
+
+   for (Uint32 i = 0; i < cplSelect.size (); i++)
+   {
+      cout << "cplSelect[" << i << "] = " << cplSelect[i].getString () << endl;
+   }
+
+   // public SelectList getSelectList ()
+   // public FromExp getFromClause ()
+   // public QueryExp getWhereClause ()
+
+   CIMPropertyList cplWhere = stmt->getWherePropertyList ();
+
+   cout << "cplWhere.size () = " << cplWhere.size () << endl;
+
+   for (Uint32 i = 0; i < cplWhere.size (); i++)
+   {
+      cout << "cplWhere[" << i << "] = " << cplWhere[i].getString () << endl;
+   }
+
+   for (Uint32 i = 0; i < instances.size (); i++)
+   {
+//////cout << "evaluate ("
+//////     << instances[i].getPath ().toString ()
+//////     << ") = "
+//////     << stmt->evaluate (instances[i])
+//////     << endl;
+
+      if (stmt->evaluate (instances[i]))
+      {
+         CIMInstance selectedInstance = instances[i].clone ();
+
+         stmt->applyProjection (selectedInstance, false);
+
+         cout << selectedInstance.getPath ().toString () << endl;
+      }
+   }
+
+   stmt->print ();
+
+   delete stmt;
+
+   client.disconnect ();
+
+   return 0;
+}