You are viewing a plain text version of this content. The canonical link for it is here.
Posted to imperius-commits@incubator.apache.org by jn...@apache.org on 2008/02/14 20:52:47 UTC
svn commit: r627867 [1/3] - in /incubator/imperius/trunk:
imperius-cimsplclientsideprovider/
imperius-cimsplclientsideprovider/resources/
imperius-cimsplclientsideprovider/resources/mofs/
imperius-cimsplclientsideprovider/resources/policies/ imperius-c...
Author: jneeraj
Date: Thu Feb 14 12:52:39 2008
New Revision: 627867
URL: http://svn.apache.org/viewvc?rev=627867&view=rev
Log:
1. Added CIMSPL client side provider
Added:
incubator/imperius/trunk/imperius-cimsplclientsideprovider/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/pom.xml (with props)
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/README.txt (with props)
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.bat (with props)
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.sh (with props)
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/mofs/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/mofs/testElement.mof
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/CascadedPolicyInvocation.spl
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/ComplexPolicy.spl
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/GroupSample.spl
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/InvokeMethodSample.spl
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MacroSample.spl
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MultiplePolicySample.spl
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/SimplePolicy1.0.1.spl
incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/testElement1Policy.spl
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIMClientSideActuatorImpl.java (with props)
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIMClientSideDataCollectorImpl.java (with props)
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIMSPLTypeConstants.java (with props)
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIM_SPLPolicyRuleClientProvider.java (with props)
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/TestClient.java (with props)
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/test/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/test/java/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/test/java/org/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/test/java/org/apache/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/test/java/org/apache/imperius/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/test/java/org/apache/imperius/cimspl/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/test/java/org/apache/imperius/cimspl/samples/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/test/java/org/apache/imperius/cimspl/samples/simplepolicies/
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/test/java/org/apache/imperius/cimspl/samples/simplepolicies/TestSimplePolicies.java (with props)
incubator/imperius/trunk/imperius-cimsplcommon/
incubator/imperius/trunk/imperius-cimsplcommon/pom.xml (with props)
incubator/imperius/trunk/imperius-cimsplcommon/resources/
incubator/imperius/trunk/imperius-cimsplcommon/resources/customexpressions.properties (with props)
incubator/imperius/trunk/imperius-cimsplcommon/src/
incubator/imperius/trunk/imperius-cimsplcommon/src/main/
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/org/
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/org/apache/
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/org/apache/imperius/
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/org/apache/imperius/cimspl/
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/org/apache/imperius/cimspl/userdefinedmethods/
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/org/apache/imperius/cimspl/userdefinedmethods/ToUINT16.java (with props)
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/org/apache/imperius/cimspl/userdefinedmethods/ToUINT32.java (with props)
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/org/apache/imperius/cimspl/userdefinedmethods/ToUINT64.java (with props)
incubator/imperius/trunk/imperius-cimsplcommon/src/main/java/org/apache/imperius/cimspl/userdefinedmethods/ToUINT8.java (with props)
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/pom.xml
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/pom.xml?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/pom.xml (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/pom.xml Thu Feb 14 12:52:39 2008
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>imperius</groupId>
+ <artifactId>imperius-cimsplclientsideprovider</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>imperius-cimsplclientsideprovider</name>
+ <dependencies>
+ <dependency>
+ <groupId>imperius</groupId>
+ <artifactId>imperius-splcore</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>imperius</groupId>
+ <artifactId>imperius-cimsplcommon</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>sblim</groupId>
+ <artifactId>sblimCIMClient</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
Propchange: incubator/imperius/trunk/imperius-cimsplclientsideprovider/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/README.txt
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/README.txt?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/README.txt (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/README.txt Thu Feb 14 12:52:39 2008
@@ -0,0 +1,101 @@
+
+ CIM-SPL Client Side Provider
+
+
+
+ What is it?
+
+-----------
+
+CIM-SPL Client Side Provider is a CIM binding for Apache Imperius.
+A CIM binding allows the Imperius engine to interact with objects in
+the CIM environment.
+The Client side provider operates as a CIM Client using the SBLIM APIs to
+interact with a running instance of a CIM server. The Client Side provider
+implements the CIM-SPL standard specification.
+
+
+Prerequisites
+-------------
+1. SBLIM CIM client jars: Download the latest SBLIM Java CIM client jars from
+http://sblim.wiki.sourceforge.net/CimClient
+
+2. A CIM Server: Like OpenPegasus 2.7.x download and install from http://www.openpegasus.org
+(Note: As the Client side provider uses the SBLIM jars any compatible CIM Server an be used)
+
+
+Build
+------
+1. Install the SBLIM jar into the Maven local repository using the following commands
+
+mvn install:install-file -Dfile=c:/sblim.jar -DgroupId=sblim \
+ -DartifactId=sblimCIMClient -Dversion=1.0.0 -Dpackaging=jar
+
+2. In the top level directory issue the command
+
+ant cimspl.runtime
+
+
+ The Latest Version
+
+------------------
+
+
+Details of the latest version can be found on the Apache Imperius
+
+Project web site <http://incubator.apache.org/Imperius/>.
+
+
+
+
+Documentation
+
+-------------
+
+
+ Documentation is available online at the project website
+
+
+Samples
+--------
+Sample polices are located under the /samples folder.
+To run the policies you need to
+1. Install and run a SBLIM compatible CIM-server like OpenPegasus
+2. Register the /samples/mofs/testElement.mof using the command
+cimmof -n root/cimv2 testElement.mof
+
+Refer to the OpenPegasus documentation for details on executing cimmof
+3. Set environment variables ANTLR_HOME, SBLIM_HOME
+4. run the cimsplcmdline.bat / .sh
+
+Usage is as follows:
+ [-s <server name>] [-p <port>] [-u <user>] [-p <pwd>]
+ -l <policy name> (DISPLAYS THE POLICY) OR
+ -c <policy path> <policy name> (CREATES A POLICY) OR
+ -m <policy path> <policy name> (MODIFIES A POLICY) OR
+ -d <policy name> (DELETES A POLICY) OR
+ -x <policy name> (EXECUTES A POLICY) OR
+ -i (LISTS ALL POLICIES) OR
+ -a (LISTS ALL POLICY NAMES)
+
+
+
+
+ Licensing
+
+---------
+
+
+This software is licensed under the terms you may find in the file
+
+ named "LICENSE" in this directory.
+
+
+
+ Thanks for using Imperius.
+
+
+The Apache Imperius Project
+
+<http://incubator.apache.org/Imperius/>
+
Propchange: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.bat
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.bat?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.bat (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.bat Thu Feb 14 12:52:39 2008
@@ -0,0 +1,3 @@
+echo "CIMSPL Client Side"
+set CLASSPATH=%CLASSPATH%;%ANTLR_HOME%/lib/antlr.jar;lib/imperius-cimsplclientsideprovider-1.0.0.jar;lib/imperius-cimsplcommon-1.0.0.jar;lib/imperius-splcore-1.0.0.jar;%SBLIM_HOME%/sblimCIMClient-1.0.0.jar
+java org.apache.imperius.cimspl.client.TestClient %1 %2 %3
Propchange: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.bat
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.sh
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.sh?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.sh (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.sh Thu Feb 14 12:52:39 2008
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "CIMSPL Client Side"
+java -classpath $ANTLR_HOME/antlr.jar:lib/imperius-cimsplclientsideprovider-1.0.0.jar:lib/imperius-cimsplcommon-1.0.0.jar:lib/imperius-splcore-1.0.0.jar:$SBLIM_HOME/sblimCIMClient-1.0.0.jar org.apache.imperius.cimspl.client.TestClient $1 $2 $3
Propchange: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/cimsplcmdline.sh
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/mofs/testElement.mof
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/mofs/testElement.mof?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/mofs/testElement.mof (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/mofs/testElement.mof Thu Feb 14 12:52:39 2008
@@ -0,0 +1,248 @@
+//////////////////////////////////////////////////////////////////////////
+// /*
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+/ //* software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// */
+//
+//
+//=============================================================================
+//
+//%///////////////////////////////////////////////////////////////////////////
+#pragma locale("en_US")
+
+class testElement
+{
+ [key]
+ string ElementName;
+
+ string s;
+ char16 c;
+ uint64 n64;
+ uint32 n32;
+ uint16 n16;
+ uint8 n8;
+ real64 r64;
+ real32 r32;
+ datetime d;
+ sint64 s64;
+ sint32 s32;
+ sint16 s16;
+ sint8 s8;
+ boolean b;
+
+ string childProperty;
+
+};
+
+class testElement1 : testElement
+{
+};
+
+class testElement2: testElement
+{
+};
+
+[association]
+class testElementAssociation
+{
+ [key]testElement ref from;
+ [key]testElement1 ref to;
+};
+
+[association]
+class testElementAssociation2
+{
+ [key]testElement ref from;
+ [key]testElement2 ref to;
+};
+
+
+//////////////////////////////////////
+// Instances definition
+
+
+
+Instance of testElement
+{
+ElementName = "element1";
+s="string5";
+c="d";
+n64=154;
+n32=54;
+n16=54;
+n8=54;
+r64=54.0;
+r32=54.0;
+d="20071129071628.000000-480";
+s64=-530;
+s32=-530;
+s16=-50;
+s8=-10;
+b=False;
+childProperty="child property5";
+};
+
+
+Instance of testElement
+{
+ElementName = "element2";
+s="string5";
+c="d";
+n64=254;
+n32=54;
+n16=54;
+n8=54;
+r64=54.0;
+r32=54.0;
+d="20071129071628.000000-480";
+s64=-530;
+s32=-530;
+s16=-50;
+s8=-10;
+b=False;
+childProperty="child property5";
+};
+
+
+Instance of testElement1
+{
+ElementName = "element10";
+s="string5";
+c="d";
+n64=54;
+n32=54;
+n16=54;
+n8=54;
+r64=54.0;
+r32=54.0;
+d="20071129071628.000000-480";
+s64=-530;
+s32=-530;
+s16=-50;
+s8=-10;
+b=False;
+childProperty="child property5";
+};
+
+Instance of testElement1
+{
+ElementName = "element11";
+s="string5";
+c="d";
+n64=54;
+n32=54;
+n16=54;
+n8=54;
+r64=54.0;
+r32=54.0;
+d="20071129071628.000000-480";
+s64=-530;
+s32=-530;
+s16=-50;
+s8=-10;
+b=False;
+childProperty="child property5";
+};
+
+Instance of testElement1
+{
+ElementName = "element12";
+s="string5";
+c="d";
+n64=54;
+n32=54;
+n16=54;
+n8=54;
+r64=54.0;
+r32=54.0;
+d="20071129071628.000000-480";
+s64=-530;
+s32=-530;
+s16=-50;
+s8=-10;
+b=False;
+childProperty="child property5";
+};
+
+Instance of testElement2
+{
+ElementName = "element20";
+s="string5";
+c="d";
+n64=54;
+n32=54;
+n16=54;
+n8=54;
+r64=54.0;
+r32=54.0;
+d="20071129071628.000000-480";
+s64=-530;
+s32=-530;
+s16=-50;
+s8=-10;
+b=False;
+childProperty="child property8";
+};
+
+Instance of testElement2
+{
+ElementName = "element21";
+s="string5";
+c="d";
+n64=54;
+n32=54;
+n16=54;
+n8=54;
+r64=54.0;
+r32=54.0;
+d="20071129071628.000000-480";
+s64=-530;
+s32=-530;
+s16=-50;
+s8=-10;
+b=False;
+childProperty="child property5";
+};
+
+/// Association Definitions
+
+instance of testElementAssociation
+{
+ from = "testElement.ElementName=\"element1\"";
+ to = "testElement1.ElementName=\"element10\"";
+};
+
+instance of testElementAssociation2
+{
+ from = "testElement.ElementName=\"element1\"";
+ to = "testElement2.ElementName=\"element20\"";
+};
+
+instance of testElementAssociation
+{
+ from = "testElement.ElementName=\"element2\"";
+ to = "testElement1.ElementName=\"element11\"";
+};
+
+instance of testElementAssociation2
+{
+ from = "testElement.ElementName=\"element2\"";
+ to = "testElement2.ElementName=\"element21\"";
+};
+
+
+
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/CascadedPolicyInvocation.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/CascadedPolicyInvocation.spl?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/CascadedPolicyInvocation.spl (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/CascadedPolicyInvocation.spl Thu Feb 14 12:52:39 2008
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* Filter out all instances of testElement exception the one with ElementName = "element1" */
+Import Qualifier root/cimv2 Class testElement testElement.ElementName=="element1";
+Strategy Execute_All_Applicable;
+Policy
+{
+ Declaration
+ { /* collect instances of testelement1 by traversing the testelementassociation association */
+ testElement1Instances = collect(Self,"testElementAssociation","from","to","testElement1", true);
+ policyToInvoke = "testElement1Policy";
+
+ }
+ Condition
+ {
+ /* if there are more than 1 instances of testelement1 */
+ CollectionSize(testElement1Instances) > 0
+
+ }
+ Decision
+ {
+ /* invoke policy testElement1Policy */
+ InvokePolicy(policyToInvoke,testElement1Instances) == 0
+ }
+}:1;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/ComplexPolicy.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/ComplexPolicy.spl?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/ComplexPolicy.spl (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/ComplexPolicy.spl Thu Feb 14 12:52:39 2008
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ Import Qualifier root/cimv2 Class testElement testElement.ElementName=="element1";
+Strategy Execute_All_Applicable;
+Policy
+{
+ Declaration
+ {
+ integervar = 4000;
+ stringtxt1 = "neeraj";
+ stringtxt2 = "joshi";
+
+ }
+ Condition
+ {
+ Power(200,2) + Abs(Ln(5) - Floor(2.4)) - Ceiling(7.1 + Ln(8)) - Max(2,5,10) - Min(4,2,9)* Round(4.2) == 4
+ }
+ Decision
+ {
+ Set(testElement.s32 = 30)
+ }
+}:1;
+Policy
+{
+ Declaration
+ {
+ someInt = 53;
+ someSt = "xyz";
+
+ }
+ Condition
+ {
+
+ someSt != collect(Self,"testElementAssociation","from","to","testElement1", true)[0].s
+ || someInt == Abs(collect(Self,"testElementAssociation","from","to","testElement1","s32",true)[0])
+
+ }
+ Decision
+ {
+ Set(testElement.s = "x") == 0
+
+ }
+}:5;
+Policy
+{
+
+ Declaration
+ {
+ somestr = "-520";
+ }
+ Condition
+ {
+ Contains(SubString(Concatenate("abc","def"),3),"ef")
+ || LeftSubString(RightSubString("neerajramchandrajoshi",6,"LeftToRight"),3,"LeftToRight") == "ram"
+ || Contains(MiddleSubString("neerajramchandrajoshi",7,10,"LeftToRight"),"ram")
+
+ }
+ Decision
+ {
+
+ Set(testElement.s = somestr) == 0
+
+ }
+}:4;
+Policy
+{
+ Declaration
+ {
+ oddarray = [1,3,5,7];
+ evenarray = [2,4,6,8];
+ allarray = [1,2,3,4,5,6,7,8];
+
+
+ }
+ Condition
+ {
+ EqCollection(Union(oddarray,evenarray),allarray)
+ && SubCollection(oddarray,allarray)
+ && AllInCollection(Sum(evenarray),"LESS",allarray)
+ && (CollectionSize(oddarray) == 4) && AnyInCollection(3, "GREATER",evenarray)
+ && (Sum(ApplyToCollection(4, "PLUS", allarray)) >= 32)
+
+ }
+ Decision
+ {
+ Set(testElement.s = "x") == 0
+
+
+ }
+
+}:3;
+Policy
+{
+ Declaration
+ {
+ todaysdate = "20070615164020.000000-240";
+ tomorrowsdate = "20070616164020.000000-240";
+ yesterdaysdate = "20070614164020.000000-240";
+
+ }
+ Condition
+ {
+ GetDayOfMonth(todaysdate) == GetDayOfMonth(tomorrowsdate) - 1
+ && GetDayOfWeek(todaysdate) == 6
+ && GetDayOfWeekInMonth(todaysdate) == 3
+ && GetHour24(todaysdate) == 16
+ && GetMonth(todaysdate) == 5
+
+
+ }
+ Decision
+ {
+ Set(testElement.s = "x") == 0
+
+
+ }
+
+}:6;
+
+
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/GroupSample.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/GroupSample.spl?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/GroupSample.spl (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/GroupSample.spl Thu Feb 14 12:52:39 2008
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* Filter out all instances of testElement exception the one with ElementName = "element1" */
+Import Qualifier root/cimv2 Class testElement testElement.ElementName=="element1";
+Strategy Execute_All_Applicable;
+Policy
+{
+ Declaration
+ {
+
+ stringtxt1 = "hello";
+ stringtxt2 = "cimspl";
+ string3 = "hellocimspl";
+
+ }
+ Condition
+ {
+ concatenate(stringtxt1,stringtxt2) == string3
+
+ }
+ Decision
+ {
+ Set(testElement.s32 = 30)
+ }
+}:2; /* Anchor element of a group needs to be associated with the top level anchor */
+PolicyGroup : testElementAssociation (from, to)
+{
+
+ Import Qualifier root/cimv2 Class testElement1;
+
+ Strategy Execute_All_Applicable;
+
+ Policy
+ {
+
+ Condition
+ {
+ Contains(SubString(Concatenate("abc","def"),3),"ef")
+
+ }
+ Decision
+ {
+
+ Set(testElement1.s = "xabc") || Set(testElement1.s32 = 30)
+
+ }
+ }:4;
+
+}:1;
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/InvokeMethodSample.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/InvokeMethodSample.spl?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/InvokeMethodSample.spl (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/InvokeMethodSample.spl Thu Feb 14 12:52:39 2008
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+Import Qualifier test/TestProvider Class Test_MethodProviderClass;
+Strategy Execute_All_Applicable;
+/*cimcli ci -n test/TestProvider Test_MethodProviderClass Id=1*/
+Policy
+{
+ Declaration
+ {
+ excpectedReturnValue = 10;
+
+ }
+ Condition
+ {
+ true
+ }
+ Decision
+ { /* InParam1 and InParam2 are formal parameter names and 10 is the expected return value */
+ Test_MethodProviderClass.Test1(InParam1=1,InParam2=2,OutParam1,OutParam2)
+ }
+}:1;
\ No newline at end of file
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MacroSample.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MacroSample.spl?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MacroSample.spl (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MacroSample.spl Thu Feb 14 12:52:39 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* Anchor class declaration */
+Import Qualifier root/cimv2 Class testElement;
+Strategy Execute_All_Applicable; /* Execute all policies */
+Declaration /* Global Declaration */
+{
+ Macro /* macro that calculates avrg of 2 nos */
+ {
+ Name = GetAverage;
+ type = Real64;
+ argument = number1:Uint64,number2:Uint64;
+ procedure = (number1 + number2) / 2
+ }
+}
+Policy
+{
+ Declaration
+ { /* constants used in t condition */
+ NoToAvrg1 = 8;
+ NoToAvrg2 = 2;
+ TwentyFive = 25;
+ }
+ Condition
+ {
+
+ SquareRoot(TwentyFive) == GetAverage(NoToAvrg1,NoToAvrg2) && AnyInCollection(5,"LESS",[6,7,8])
+ }
+ Decision
+ { /* set testElement.s32 to 3 */
+ Set(testElement.s32 = 4)
+ }
+
+}:1; /* Priority of the policy */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MultiplePolicySample.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MultiplePolicySample.spl?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MultiplePolicySample.spl (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/MultiplePolicySample.spl Thu Feb 14 12:52:39 2008
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* Anchor class declaration */
+Import Qualifier root/cimv2 Class testElement;
+Strategy Execute_All_Applicable; /* Execute all policies */
+Declaration /* Global Declaration */
+{
+ Macro /* macro that calculates avrg of 2 nos */
+ {
+ Name = GetAverage;
+ type = Real64;
+ argument = number1:Uint64,number2:Uint64;
+ procedure = (number1 + number2) / 2
+ }
+}
+Policy
+{
+ Declaration
+ { /* constants used in t condition */
+ NoToAvrg1 = 8;
+ NoToAvrg2 = 2;
+ TwentyFive = 25;
+ }
+ Condition
+ {
+
+ SquareRoot(TwentyFive) == GetAverage(NoToAvrg1,NoToAvrg2)
+ }
+ Decision
+ { /* set testElement.s32 to 3 */
+ Set(testElement.s32 = 3)
+ }
+
+}:2; /* Priority of the policy */
+Policy
+{
+ Declaration
+ { /* even and odd array constants */
+ evenArray = [0,2,4,6,8];
+ oddArray = [1,3,5,7,9];
+ sumOfnumbersTill9 = 45;
+
+ Macro /* macro to add all elements of passed array */
+ {
+ Name = Add2Arrays;
+ type = Uint32;
+ argument = array1:Uint32[],array2:Uint32[];
+ procedure = sum(array1) + sum(array2)
+
+ }
+ }
+ Condition
+ {
+ Add2Arrays(evenArray,oddArray) == sumOfnumbersTill9
+
+
+ }
+ Decision
+ { /* set testElement.s32 to 3 */
+ Set(testElement.s32 = 3)
+ }
+
+}:1;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/SimplePolicy1.0.1.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/SimplePolicy1.0.1.spl?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/SimplePolicy1.0.1.spl (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/SimplePolicy1.0.1.spl Thu Feb 14 12:52:39 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+Import Qualifier root/cimv2 Class testElement;
+Strategy Execute_All_Applicable;
+Policy
+{
+Declaration
+{
+ four = 4;
+}
+Condition
+{
+
+ SquareRoot(16) == four
+}
+Decision
+{
+ Set(testElement.s32 = 4)
+}
+}:1;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/testElement1Policy.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/testElement1Policy.spl?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/testElement1Policy.spl (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/resources/policies/testElement1Policy.spl Thu Feb 14 12:52:39 2008
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+Import Qualifier root/cimv2 Class testElement1;
+
+Strategy Execute_All_Applicable;
+
+Policy
+{
+ Declaration
+ {
+ evenArray = [2,4,6,8];
+ oddArray = [1,3,5,7,9];
+ mixedArray = [1,3,4,5,8];
+ }
+ Condition
+ {
+ SubCollection(mixedArray,Union(evenArray,oddArray))
+
+ }
+ Decision
+ {
+
+ Set(testElement1.s = "xyzs")
+
+ }
+}:1;
\ No newline at end of file
Added: incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIMClientSideActuatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIMClientSideActuatorImpl.java?rev=627867&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIMClientSideActuatorImpl.java (added)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIMClientSideActuatorImpl.java Thu Feb 14 12:52:39 2008
@@ -0,0 +1,727 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Neeraj Joshi <jn...@us.ibm.com>
+ *
+ */
+
+
+
+package org.apache.imperius.cimspl.client;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.Set;
+import java.util.Iterator;
+import java.math.BigInteger;
+
+import org.sblim.wbem.cim.CIMArgument;
+import org.sblim.wbem.cim.CIMClass;
+import org.sblim.wbem.cim.CIMDataType;
+import org.sblim.wbem.cim.CIMDateTime;
+import org.sblim.wbem.cim.CIMException;
+import org.sblim.wbem.cim.CIMInstance;
+import org.sblim.wbem.cim.CIMMethod;
+import org.sblim.wbem.cim.CIMObjectPath;
+import org.sblim.wbem.cim.CIMParameter;
+import org.sblim.wbem.cim.CIMProperty;
+import org.sblim.wbem.cim.CIMSimpleDateTime;
+import org.sblim.wbem.cim.CIMValue;
+import org.sblim.wbem.cim.UnsignedInt16;
+import org.sblim.wbem.cim.UnsignedInt32;
+import org.sblim.wbem.cim.UnsignedInt64;
+import org.sblim.wbem.cim.UnsignedInt8;
+import org.sblim.wbem.client.CIMClient;
+
+
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.external.Argument;
+import org.apache.imperius.spl.parser.exceptions.*;
+import org.apache.imperius.util.SPLLogger;
+
+public class CIMClientSideActuatorImpl implements Actuator
+{
+
+ private static CIMClient handle = null;
+ private static final String sourceClass="ActuatorImpl";
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+
+ public CIMClientSideActuatorImpl(CIMClient ch)
+ {
+ handle=ch;
+ }
+
+
+
+
+
+ //instanceKeys is a Map containing (name,value) pairs, inParameters and outParameters are maps that have (name,value) pairs which are the arguments for the method
+
+ public Object invokeMethod(String className,String namespace,Object instance,String methodName, List inParameterValues) throws SPLException {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "invokeMethod");
+
+ Vector inParams=new Vector();
+ Vector outParams=new Vector();
+ CIMObjectPath cop=new CIMObjectPath(className,namespace);
+
+ if(className!=null && namespace!=null){
+ try
+ {
+
+ Iterator it=inParameterValues.iterator();
+ Map cimArgNameValuePairs= new HashMap();
+ while(it.hasNext())
+ {
+ Argument arg=(Argument)it.next();
+ cimArgNameValuePairs.put(arg.getName(), arg.getValue());
+ //System.out.println(" added to cimArgNameValuePairs : "+arg.getName()+ " "+arg.getValue().toString());
+ }
+
+
+
+
+ if(instance instanceof CIMObjectPath)
+ {
+ cop=(CIMObjectPath)instance;
+ CIMObjectPath classCop=new CIMObjectPath(className,namespace);
+ CIMClass cimclass=handle.getClass(classCop, true, true, true, null);
+
+ CIMMethod cimMethod= cimclass.getMethod(methodName);
+ Vector params = cimMethod.getParameters();
+ for(int j=0;j<params.size();j++)
+ {
+ CIMParameter cimparameter=(CIMParameter)params.get(j);
+ String parameterName=cimparameter.getName();
+ int type=cimparameter.getType().getType();
+ //boolean isArray=cimparameter.isArray();
+ //System.out.println("parameter name = "+parameterName);
+ Object paramValue=cimArgNameValuePairs.get(parameterName);
+ if(paramValue!=null){
+
+
+ CIMValue cv=getCIMObjectOfGivenType(type, paramValue);
+ //System.out.println("parameter value = "+paramValue+ " "+cv.toString());
+ //new CIMArgument(parameterName,cv);
+ inParams.add(new CIMArgument(parameterName,cv));
+ }
+
+ else
+ {
+ //System.out.println("value = null");
+ }
+
+ }
+
+ if(logger.isLoggable(Level.FINE))
+ logger.fine(Thread.currentThread().getName()+" Actuator::invokeMethod:invoking method "+methodName);
+ CIMObjectPath instanceCop=new CIMObjectPath(className,namespace);
+ instanceCop.setKeys(cop.getKeys());
+
+ //System.out.println("cop, methodName :"+instanceCop+" "+ methodName);
+ CIMValue cv=handle.invokeMethod(instanceCop, methodName, inParams, outParams);
+ //System.out.println("invokeMethod complete : return value="+cv.getValue());
+ if(logger.isLoggable(Level.FINE))
+ logger.fine(Thread.currentThread().getName()+" Actuator::invokeMethod:done invoking method");
+ if(logger.isLoggable(Level.FINE))
+ logger.fine(outParams.toString());
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "invokeMethod");
+ Integer returnVal=new Integer(1);
+ return returnVal;
+
+ }
+ else{
+ logger.severe(Thread.currentThread().getName()+" "+"instance for method invokation is not of type CIMObjectPath");
+ throw new SPLException("instance for method invokation is not of type CIMObjectPath");
+
+ }
+ }
+ catch(CIMException e){
+ e.printStackTrace();
+ //System.out.println(e.getMessage());
+ logger.severe(Thread.currentThread().getName()+" "+"invokeMethod Failed "+methodName+" "+ className+ " " + namespace+" "+e.getMessage());
+ throw new SPLException("invokeMethod Failed"+methodName+" "+ className+ " " + namespace +" "+ e.getMessage());
+ }
+ }
+ else {
+ logger.severe(Thread.currentThread().getName()+" "+"This CIM class is not handled by the Policy Provider");
+ throw new InvalidCIMParameterException("This CIM class is not handled by the Policy Provider");
+ }
+
+
+ }
+
+
+ //_className, qualifier, instance, modifiedProperties
+ public void modifyInstance(String className,String namespace,
+ Object instance, Map properties) throws SPLException
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "modifyInstance");
+ if(className!=null && namespace!=null)
+ {
+ try
+ {
+ if(instance instanceof CIMObjectPath)
+ {
+ CIMObjectPath copTemp=(CIMObjectPath)instance;
+ CIMObjectPath cop=new CIMObjectPath(className,namespace);
+ cop.setKeys(copTemp.getKeys());
+
+
+ if(logger.isLoggable(Level.FINE))
+ logger.fine(Thread.currentThread().getName()+" Actuator::Modify instance :cop"+cop);
+
+ CIMInstance cimInstance= null;
+ try
+ {
+ cimInstance=handle.getInstance(cop, true, true, true, null);
+ }
+ catch(CIMException e)
+ {
+ logger.severe(Thread.currentThread().getName()+" "+
+ "instance does not belong to Anchor Class, might be of an extension of Anchor class, " +
+ "no action will be taken on it. "+e.getMessage());
+ throw new SPLException("instance does not belong to Anchor Class, might be of an " +
+ "extension of Anchor class, no action will be taken on it. "+e.getMessage());
+
+ }
+ if(cimInstance != null)
+ {
+ Vector modifiedProperties = new Vector();
+
+ Vector instanceProperties = cimInstance.getAllProperties();
+ Set propertyNames = properties.keySet();
+ Iterator propertyIterator = propertyNames.iterator();
+ while(propertyIterator.hasNext())
+ {
+ String keyName = (String)propertyIterator.next();
+ Object keyValue = properties.get(keyName);
+ Iterator instancePropertyIterator = instanceProperties.iterator();
+
+ while(instancePropertyIterator.hasNext())
+ {
+ CIMProperty cimprop=(CIMProperty)instancePropertyIterator.next();
+ String name=cimprop.getName();
+ int type=cimprop.getType().getType();
+ // boolean isArray=cimprop.isArray();
+ CIMValue instValue=cimprop.getValue();
+ if(cimprop.getName().equalsIgnoreCase(keyName))
+ {
+ Object cimKeyValue = keyValue;
+ if(logger.isLoggable(Level.FINE))
+ logger.fine(Thread.currentThread().getName()+
+ " Instance property:: Name,Type,Value,CIMKeyValue :"+name+" "+type+" "
+ +instValue+" "+ cimKeyValue.getClass());
+
+ CIMValue cimval = getCIMObjectOfGivenType(type,cimKeyValue);
+
+
+ cimprop.setValue(cimval);
+ handle.setProperty(cimInstance.getObjectPath(), keyName, cimval);
+ modifiedProperties.add(cimprop);
+ if(logger.isLoggable(Level.FINE))
+ logger.fine(Thread.currentThread().getName()+" cimprop set to cimValue "+cimval.getValue());
+ }
+
+ }
+
+ }
+ if(logger.isLoggable(Level.FINE))
+ logger.fine(Thread.currentThread().getName()+" done setting all properties");
+
+ // cimInstance.setProperties(modifiedProperties);
+ // handle.setInstance(cop, cimInstance);
+
+
+ // handle.modifyInstance(cop, cimInstance, true, null);
+ if(logger.isLoggable(Level.FINE))
+ logger.fine(Thread.currentThread().getName()+" done modifying CIMInstance");
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "modifyInstance");
+ }
+ }
+ else
+ {
+
+ logger.severe(Thread.currentThread().getName()+" "+"instance for method invokation is not of type CIMObjectPath");
+ throw new SPLException("instance for method invokation is not of type CIMObjectPath");
+ }
+
+ }
+ catch(CIMException e){
+ e.printStackTrace();
+ logger.severe(Thread.currentThread().getName()+" "+"modify instance Failed :"+ className+ " " + namespace);
+ throw new SPLException("modify Instance Failed :"+ className+ " " + namespace);
+ }
+ }
+ else {
+ logger.severe(Thread.currentThread().getName()+" "+"This CIM class is not handled by the Policy Provider");
+ throw new InvalidCIMParameterException("This CIM class is not handled by the Policy Provider");
+ }
+
+ }
+
+
+ public void init(CIMClient ch) throws SPLException {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "init");
+ handle=ch;
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "init");
+
+
+ }
+ /* (non-Javadoc)
+ * @see com.ibm.pegasus.cimspl.helper.DataCollector#shutDown()
+ */
+ public void shutDown() {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "init");
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "init");
+
+ }
+
+ private CIMValue getCIMObjectOfGivenType(int type, Object CIMKeyValue)
+ throws CIMException,SPLException
+ {
+ CIMValue cimval=null;
+
+ switch(type)
+ {
+ case CIMDataType.UINT8_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List uintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Short sht=new Short(Short.parseShort((arrayIt.next()).toString()));
+ UnsignedInt8 uint8= new UnsignedInt8(sht.shortValue());
+ uintArray.add(uint8);
+ }
+ Object actualValue=(UnsignedInt8[])uintArray.toArray();
+ CIMDataType uint8ArrType = new CIMDataType(CIMDataType.UINT8_ARRAY);
+ cimval=new CIMValue(actualValue, uint8ArrType);
+
+ }
+ break;
+ case CIMDataType.UINT16_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List uintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Integer integ=new Integer(Integer.parseInt((arrayIt.next()).toString()));
+ UnsignedInt16 uint16= new UnsignedInt16(integ.intValue());
+ uintArray.add(uint16);
+ }
+ Object actualValue=(UnsignedInt16[])uintArray.toArray();
+ CIMDataType uint16ArrType = new CIMDataType(CIMDataType.UINT16_ARRAY);
+ cimval=new CIMValue(actualValue,uint16ArrType);
+ }
+ break;
+ case CIMDataType.UINT32_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List uintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Long lng=new Long(Long.parseLong((arrayIt.next()).toString()));
+ UnsignedInt32 uint32= new UnsignedInt32(lng.longValue());
+ uintArray.add(uint32);
+ }
+ Object actualValue=(UnsignedInt32[])uintArray.toArray();
+ CIMDataType uint32ArrType = new CIMDataType(CIMDataType.UINT32_ARRAY);
+ cimval=new CIMValue(actualValue,uint32ArrType);
+ }
+ break;
+ case CIMDataType.UINT64_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List uintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Long lng=new Long(Long.parseLong((arrayIt.next()).toString()));
+ BigInteger big=BigInteger.valueOf(lng.longValue());
+ UnsignedInt64 uint64= new UnsignedInt64(big.abs());
+ uintArray.add(uint64);
+ }
+ Object actualValue=(UnsignedInt64[])uintArray.toArray();
+ CIMDataType uint64ArrType = new CIMDataType(CIMDataType.UINT64_ARRAY);
+ cimval=new CIMValue(actualValue,uint64ArrType);
+ }
+ break;
+ case CIMDataType.SINT8_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List sintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Byte bt=new Byte(Byte.parseByte((arrayIt.next()).toString()));
+ sintArray.add(bt);
+ }
+ Object actualValue=(Byte[])sintArray.toArray();
+ CIMDataType sint8ArrType = new CIMDataType(CIMDataType.SINT8_ARRAY);
+ cimval=new CIMValue(actualValue,sint8ArrType);
+ }
+ break;
+
+ case CIMDataType.SINT16_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List sintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Short bt=new Short(Short.parseShort((arrayIt.next()).toString()));
+ sintArray.add(bt);
+ }
+ Object actualValue=(Short[])sintArray.toArray();
+ CIMDataType sint16ArrType = new CIMDataType(CIMDataType.SINT16_ARRAY);
+ cimval=new CIMValue(actualValue,sint16ArrType);
+ }
+ break;
+ case CIMDataType.SINT32_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List sintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Integer bt=new Integer(Integer.parseInt((arrayIt.next()).toString()));
+ sintArray.add(bt);
+ }
+ Object actualValue=(Integer[])sintArray.toArray();
+ CIMDataType sint32ArrType = new CIMDataType(CIMDataType.SINT32_ARRAY);
+ cimval=new CIMValue(actualValue,sint32ArrType);
+ }
+ break;
+
+ case CIMDataType.SINT64_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List sintArray=new ArrayList();
+ while(arrayIt.hasNext()){
+ Long bt=new Long(Long.parseLong((arrayIt.next()).toString()));
+ sintArray.add(bt);
+ }
+ Object actualValue=(Long[])sintArray.toArray();
+ CIMDataType sint64ArrType = new CIMDataType(CIMDataType.SINT64_ARRAY);
+ cimval=new CIMValue(actualValue,sint64ArrType);
+ }
+ break;
+
+ case CIMDataType.REAL32_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List sintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Float bt=new Float(Float.parseFloat((arrayIt.next()).toString()));
+ sintArray.add(bt);
+ }
+ Object actualValue=(Float[])sintArray.toArray();
+ CIMDataType real32ArrType = new CIMDataType(CIMDataType.REAL32_ARRAY);
+ cimval=new CIMValue(actualValue,real32ArrType);
+ }
+ break;
+
+ case CIMDataType.REAL64_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List sintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Double bt=new Double(Double.parseDouble((arrayIt.next()).toString()));
+ sintArray.add(bt);
+ }
+ Object actualValue=(Double[])sintArray.toArray();
+ CIMDataType real64ArrType = new CIMDataType(CIMDataType.REAL64_ARRAY);
+ cimval=new CIMValue(actualValue,real64ArrType);
+ }
+ break;
+
+ case CIMDataType.BOOLEAN_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List sintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Boolean bt=Boolean.valueOf((arrayIt.next()).toString());
+ sintArray.add(bt);
+ }
+ Object actualValue=(Boolean[])sintArray.toArray();
+ CIMDataType boolArrType = new CIMDataType(CIMDataType.BOOLEAN_ARRAY);
+ cimval=new CIMValue(actualValue,boolArrType);
+ }
+ break;
+ case CIMDataType.CHAR16_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List sintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Character bt=new Character(((arrayIt.next()).toString()).charAt(0));
+ sintArray.add(bt);
+ }
+ Object actualValue=(Character[])sintArray.toArray();
+ CIMDataType char16ArrType = new CIMDataType(CIMDataType.CHAR16_ARRAY);
+ cimval=new CIMValue(actualValue,char16ArrType);
+ }
+ break;
+
+ case CIMDataType.STRING_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List sintArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ String bt=(arrayIt.next()).toString();
+ sintArray.add(bt);
+ }
+ Object actualValue=(String[])sintArray.toArray();
+ CIMDataType stringArrType = new CIMDataType(CIMDataType.STRING_ARRAY);
+ cimval=new CIMValue(actualValue,stringArrType);
+ }
+ break;
+
+ case CIMDataType.DATETIME_ARRAY:
+ {
+ if(!(CIMKeyValue instanceof List))
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"expected a List");
+ throw new SPLException("expected a List");
+ }
+ List intArray=(List)CIMKeyValue;
+ Iterator arrayIt=intArray.iterator();
+ List cimDateTimeArray=new ArrayList();
+ while(arrayIt.hasNext())
+ {
+ Object ob=arrayIt.next();
+ if(!(ob instanceof Calendar)){
+ throw new SPLException("Value should be of type Calendar");
+ }
+ Calendar cal=(Calendar)ob;
+ CIMDateTime calCIM=new CIMSimpleDateTime(cal);
+ cimDateTimeArray.add(calCIM);
+ }
+ Object actualValue=(CIMDateTime[])cimDateTimeArray.toArray();
+ CIMDataType calArrType = new CIMDataType(CIMDataType.DATETIME_ARRAY);
+ cimval=new CIMValue(actualValue,calArrType);
+ }
+ break;
+
+ case CIMDataType.UINT8:
+ {
+ Short sht=new Short(Short.parseShort(CIMKeyValue.toString()));
+ UnsignedInt8 uint8= new UnsignedInt8(sht.shortValue());
+ CIMDataType uint8Type = new CIMDataType(CIMDataType.UINT8);
+ cimval=new CIMValue(uint8,uint8Type);
+ }
+ break;
+ case CIMDataType.UINT16:
+ {
+ Integer integ=new Integer(Integer.parseInt(CIMKeyValue.toString()));
+ UnsignedInt16 uint16= new UnsignedInt16(integ.intValue());
+ CIMDataType uint16Type = new CIMDataType(CIMDataType.UINT16);
+ cimval=new CIMValue(uint16,uint16Type);
+ }
+ break;
+ case CIMDataType.UINT32:
+ {
+ Long lng=new Long(Long.parseLong(CIMKeyValue.toString()));
+ UnsignedInt32 uint32= new UnsignedInt32(lng.longValue());
+ CIMDataType uint32Type = new CIMDataType(CIMDataType.UINT32);
+ cimval=new CIMValue(uint32,uint32Type);
+ }
+ break;
+ case CIMDataType.UINT64:
+ {
+ Long shrt=new Long(Long.parseLong(CIMKeyValue.toString()));
+ BigInteger big=BigInteger.valueOf(shrt.longValue());
+ UnsignedInt64 uint64= new UnsignedInt64(big.abs());
+ CIMDataType uint64Type = new CIMDataType(CIMDataType.UINT64);
+ cimval=new CIMValue(uint64,uint64Type);
+ }
+ break;
+ case CIMDataType.SINT8:
+ {
+ Byte byt=new Byte(Byte.parseByte(CIMKeyValue.toString()));
+ CIMDataType sint8Type = new CIMDataType(CIMDataType.SINT8);
+ cimval=new CIMValue(byt,sint8Type);
+ }
+ break;
+ case CIMDataType.SINT16:
+ {
+ Short sht=new Short(Short.parseShort(CIMKeyValue.toString()));
+ CIMDataType sint16Type = new CIMDataType(CIMDataType.SINT16);
+ cimval=new CIMValue(sht,sint16Type);
+ }
+ break;
+ case CIMDataType.SINT32:
+ {
+ Integer integ=new Integer(Integer.parseInt(CIMKeyValue.toString()));
+ CIMDataType sint32Type = new CIMDataType(CIMDataType.SINT32);
+ cimval=new CIMValue(integ,sint32Type);
+ }
+ break;
+ case CIMDataType.SINT64:
+ {
+ Long lng=new Long(Long.parseLong(CIMKeyValue.toString()));
+ CIMDataType sint64Type = new CIMDataType(CIMDataType.SINT64);
+ cimval=new CIMValue(lng,sint64Type);
+ }
+ break;
+ case CIMDataType.REAL32:
+ {
+ Float flt=new Float(Float.parseFloat(CIMKeyValue.toString()));
+ CIMDataType real32Type = new CIMDataType(CIMDataType.REAL32);
+ cimval=new CIMValue(flt,real32Type);
+ }
+ break;
+ case CIMDataType.REAL64:
+ {
+ Double dbl=new Double(Double.parseDouble(CIMKeyValue.toString()));
+ CIMDataType real64Type = new CIMDataType(CIMDataType.REAL64);
+ cimval=new CIMValue(dbl,real64Type);
+ }
+ break;
+ case CIMDataType.CHAR16:
+ {
+ Character cha=new Character((CIMKeyValue.toString()).charAt(0));
+ CIMDataType char16Type = new CIMDataType(CIMDataType.CHAR16);
+ cimval=new CIMValue(cha,char16Type);
+ }
+ break;
+ case CIMDataType.BOOLEAN:
+ {
+ Boolean booln=Boolean.valueOf(CIMKeyValue.toString());
+ CIMDataType boolType = new CIMDataType(CIMDataType.BOOLEAN);
+ cimval=new CIMValue(booln,boolType);
+ }
+ break;
+ case CIMDataType.STRING:
+ {
+ String str=CIMKeyValue.toString();
+ CIMDataType stringType = new CIMDataType(CIMDataType.STRING);
+ cimval=new CIMValue(str,stringType);
+ }
+ break;
+ case CIMDataType.DATETIME:
+ {
+ if(!(CIMKeyValue instanceof Calendar)){
+ throw new SPLException("Value should be of type Calendar");
+ }
+ Calendar cal=(Calendar)CIMKeyValue;
+ CIMDateTime calCIM=new CIMSimpleDateTime(cal);
+ CIMDataType calType = new CIMDataType(CIMDataType.DATETIME);
+ cimval=new CIMValue(calCIM,calType);
+ }
+ break;
+ default:
+ throw new SPLException("invalid type " + type);
+ }
+
+
+ return cimval;
+ }
+
+
+
+
+}
Propchange: incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIMClientSideActuatorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native