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/20 20:40:15 UTC
svn commit: r629608 [1/3] - in /incubator/imperius/trunk: ./ cimspl-samples/
cimspl-samples/resources/ cimspl-samples/resources/samples/
cimspl-samples/resources/samples/mofs/
cimspl-samples/resources/samples/policies/ cimspl-samples/src/
cimspl-sample...
Author: jneeraj
Date: Wed Feb 20 12:40:03 2008
New Revision: 629608
URL: http://svn.apache.org/viewvc?rev=629608&view=rev
Log:
1. Added CIM-SPL processor that runs as a OpenPegasus Provider
2. Added CIM-SPL samples with a command line utility
3. Added Apache copyright to cimsplclientsideprovider
4. Updated build to have a new target called cimspl.runtime and cimspl.clientsideruntime
5. Updated pom.xml with a new profile for cimspl
Added:
incubator/imperius/trunk/cimspl-samples/
incubator/imperius/trunk/cimspl-samples/pom.xml (with props)
incubator/imperius/trunk/cimspl-samples/resources/
incubator/imperius/trunk/cimspl-samples/resources/README.txt (with props)
incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.bat (with props)
incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.sh (with props)
incubator/imperius/trunk/cimspl-samples/resources/samples/
incubator/imperius/trunk/cimspl-samples/resources/samples/mofs/
incubator/imperius/trunk/cimspl-samples/resources/samples/mofs/testElement.mof
incubator/imperius/trunk/cimspl-samples/resources/samples/policies/
incubator/imperius/trunk/cimspl-samples/resources/samples/policies/CascadedPolicyInvocation.spl
incubator/imperius/trunk/cimspl-samples/resources/samples/policies/ComplexPolicy.spl
incubator/imperius/trunk/cimspl-samples/resources/samples/policies/GroupSample.spl
incubator/imperius/trunk/cimspl-samples/resources/samples/policies/InvokeMethodSample.spl
incubator/imperius/trunk/cimspl-samples/resources/samples/policies/MacroSample.spl
incubator/imperius/trunk/cimspl-samples/resources/samples/policies/MultiplePolicySample.spl
incubator/imperius/trunk/cimspl-samples/resources/samples/policies/SimplePolicy1.0.1.spl
incubator/imperius/trunk/cimspl-samples/resources/samples/policies/testElement1Policy.spl
incubator/imperius/trunk/cimspl-samples/src/
incubator/imperius/trunk/cimspl-samples/src/main/
incubator/imperius/trunk/cimspl-samples/src/main/java/
incubator/imperius/trunk/cimspl-samples/src/main/java/org/
incubator/imperius/trunk/cimspl-samples/src/main/java/org/apache/
incubator/imperius/trunk/cimspl-samples/src/main/java/org/apache/imperius/
incubator/imperius/trunk/cimspl-samples/src/main/java/org/apache/imperius/cimspl/
incubator/imperius/trunk/cimspl-samples/src/main/java/org/apache/imperius/cimspl/client/
incubator/imperius/trunk/cimspl-samples/src/main/java/org/apache/imperius/cimspl/client/TestClient.java (with props)
incubator/imperius/trunk/imperius-cimsplprovider/
incubator/imperius/trunk/imperius-cimsplprovider/pom.xml (with props)
incubator/imperius/trunk/imperius-cimsplprovider/resources/
incubator/imperius/trunk/imperius-cimsplprovider/resources/README.txt (with props)
incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/
incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRule.mof
incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRuleProviderR.mof
incubator/imperius/trunk/imperius-cimsplprovider/src/
incubator/imperius/trunk/imperius-cimsplprovider/src/main/
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/org/
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/org/apache/
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/org/apache/imperius/
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/org/apache/imperius/cimspl/
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/org/apache/imperius/cimspl/CIMActuatorImpl.java (with props)
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/org/apache/imperius/cimspl/CIMDataCollectorImpl.java (with props)
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/org/apache/imperius/cimspl/CIMSPLTypeConstants.java (with props)
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/org/apache/imperius/cimspl/CIM_SPLPolicyRuleProvider.java (with props)
incubator/imperius/trunk/imperius-cimsplprovider/src/main/java/org/apache/imperius/cimspl/PolicyInstance.java (with props)
Modified:
incubator/imperius/trunk/build.xml
incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIM_SPLPolicyRuleClientProvider.java
incubator/imperius/trunk/pom.xml
Modified: incubator/imperius/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/build.xml?rev=629608&r1=629607&r2=629608&view=diff
==============================================================================
--- incubator/imperius/trunk/build.xml (original)
+++ incubator/imperius/trunk/build.xml Wed Feb 20 12:40:03 2008
@@ -43,7 +43,8 @@
<property name="JAVASPL_SAMPLES_DIR" value="${IMPERIUS_SVN_MODULES}/javaspl-samples"/>
<property name="IMPERIUS_CIMSPLCOMMON_DIR" value="${IMPERIUS_SVN_MODULES}/imperius-cimsplcommon"/>
<property name="IMPERIUS_CIMSPLCLIENTSIDE_DIR" value="${IMPERIUS_SVN_MODULES}/imperius-cimsplclientsideprovider"/>
-
+ <property name="IMPERIUS_CIMSPL_DIR" value="${IMPERIUS_SVN_MODULES}/imperius-cimsplprovider"/>
+ <property name="CIMSPL_SAMPLES_DIR" value="${IMPERIUS_SVN_MODULES}/cimspl-samples"/>
<property name="IMPERIUS_LOGGING_FILE" value="log.txt"/>
<property name="JavaSPL" value="Java_SPL"/>
@@ -130,11 +131,14 @@
<arg line="co http://svn.apache.org/repos/asf/incubator/imperius/trunk/imperius-cimsplcommon"/>
</exec>
<exec executable="svn" searchpath="true" dir="." failonerror="true">
- <arg line="co http://svn.apache.org/repos/asf/incubator/imperius/trunk/imperius-cimsplcommon"/>
+ <arg line="co http://svn.apache.org/repos/asf/incubator/imperius/trunk/cimspl-samples"/>
</exec>
<exec executable="svn" searchpath="true" dir="." failonerror="true">
<arg line="co http://svn.apache.org/repos/asf/incubator/imperius/trunk/imperius-cimsplclientsideprovider"/>
</exec>
+ <exec executable="svn" searchpath="true" dir="." failonerror="true">
+ <arg line="co http://svn.apache.org/repos/asf/incubator/imperius/trunk/imperius-cimsplprovider"/>
+ </exec>
<!-- <exec executable="svn" searchpath="true" dir="." failonerror="true">
@@ -416,10 +420,153 @@
</target>
+ <!-- PACKAGE CIMSPL SAMPLES -->
+ <target name="package.cimsplsamples" description="create cimsplsamples.zip">
+ <echo message="creating cimsplsamples"/>
+ <delete dir="${TMP}"/>
+
+ <mkdir dir="${TMP}/cimspl-samples${VERSION}/lib"/>
+ <mkdir dir="${TMP}/cimspl-samples${VERSION}/samples/mofs"/>
+ <mkdir dir="${TMP}/cimspl-samples${VERSION}/samples/policies"/>
+ <!-- copy cimsplclient jar-->
+ <copy todir="${TMP}/cimspl-samples${VERSION}/lib" failonerror="true" overwrite="true">
+ <fileset dir="${CIMSPL_SAMPLES_DIR}/target">
+ <include name="*.jar"/>
+ </fileset>
+ </copy>
+ <!-- rename file -->
+ <move file="${TMP}/cimspl-samples${VERSION}/lib/cimspl-samples-1.0.0-SNAPSHOT.jar" tofile="${TMP}/cimspl-samples${VERSION}/lib/cimspl-client-${VERSION}.jar"/>
+ <!-- copy sample policies-->
+ <copy todir="${TMP}/cimspl-samples${VERSION}/samples/policies">
+ <fileset dir="${CIMSPL_SAMPLES_DIR}/resources/samples/policies"/>
+ </copy>
+
+ <!-- copy sample mof-->
+ <copy todir="${TMP}/cimspl-samples${VERSION}/samples/mofs">
+ <fileset dir="${CIMSPL_SAMPLES_DIR}/resources/samples/mofs">
+ <include name="testElement.mof"/>
+ </fileset>
+ </copy>
+
+ <!-- copy bat/sh scripts and readmes-->
+ <copy todir="${TMP}/cimspl-samples${VERSION}">
+ <fileset dir="${CIMSPL_SAMPLES_DIR}/resources/">
+ <include name="*.txt"/>
+ <include name="*.bat"/>
+ <include name="*.sh"/>
+ </fileset>
+ </copy>
+ <!-- copy in the notice -->
+ <copy todir="${TMP}/cimspl-samples${VERSION}" file="${APACHE_NOTICE_FILE}"/>
+
+ <!-- copy in the license -->
+ <copy todir="${TMP}/cimspl-samples${VERSION}" file="${APACHE_LICENSE_FILE}"/>
+
+ <!-- zip the contents -->
+
+ <zip destfile="${IMPERIUS_DIST}/cimspl-samples${VERSION}-bin.zip" basedir="${TMP}"/>
+
+ <!-- tar gz the contents -->
+ <tar destfile="${IMPERIUS_DIST}/cimspl-samples${VERSION}-bin.tar.gz" basedir="${TMP}" compression="gzip"/>
+
+ <!-- delete tmp dir -->
+ <delete dir="${TMP}"/>
+
+
+
+ </target>
+
+ <!-- PACKAGE CIMSPL PROVIDER-->
+ <target name="package.cimsplprovider" description="creates cimsplprovider.zip">
+ <echo message="Creating CIMSPLProvider.zip"/>
+ <delete dir="${TMP}"/>
+
+ <mkdir dir="${TMP}/imperius-cimsplprovider${VERSION}/lib"/>
+ <mkdir dir="${TMP}/imperius-cimsplprovider${VERSION}/docs/javadoc"/>
+ <mkdir dir="${TMP}/imperius-cimsplprovider${VERSION}/mofs"/>
+
+ <!-- copy pre req jars-->
+ <copy todir="${TMP}/imperius-cimsplprovider${VERSION}/lib" failonerror="true" overwrite="true">
+ <fileset dir="${IMPERIUS_SPLCORE_DIR}/target">
+ <include name="*.jar"/>
+ </fileset>
+ </copy>
+ <!-- rename file -->
+ <move file="${TMP}/imperius-cimsplprovider${VERSION}/lib/imperius-splcore-1.0.0-SNAPSHOT.jar" tofile="${TMP}/imperius-cimsplprovider${VERSION}/lib/imperius-splcore-${VERSION}.jar"/>
+
+ <!-- copy pre req jars-->
+ <copy todir="${TMP}/imperius-cimsplprovider${VERSION}/lib" failonerror="true" overwrite="true">
+ <fileset dir="${IMPERIUS_CIMSPLCOMMON_DIR}/target">
+ <include name="*.jar"/>
+ </fileset>
+ </copy>
+ <!-- rename file -->
+ <move file="${TMP}/imperius-cimsplprovider${VERSION}/lib/imperius-cimsplcommon-1.0.0-SNAPSHOT.jar" tofile="${TMP}/imperius-cimsplprovider${VERSION}/lib/imperius-cimsplcommon-${VERSION}.jar"/>
+
+ <!-- copy customexpressions.properties -->
+ <copy todir="${TMP}/imperius-cimsplprovider${VERSION}" failonerror="true" overwrite="true">
+ <fileset dir="${IMPERIUS_CIMSPLCOMMON_DIR}/resources">
+ <include name="*.properties"/>
+ </fileset>
+ </copy>
+
+
+ <!-- copy cimsplprovider jars-->
+ <copy todir="${TMP}/imperius-cimsplprovider${VERSION}/lib" failonerror="true" overwrite="true">
+ <fileset dir="${IMPERIUS_CIMSPL_DIR}/target">
+ <include name="*.jar"/>
+ </fileset>
+ </copy>
+ <!-- rename file -->
+ <move file="${TMP}/imperius-cimsplprovider${VERSION}/lib/imperius-cimsplprovider-1.0.0-SNAPSHOT.jar" tofile="${TMP}/imperius-cimsplprovider${VERSION}/lib/imperius-cimsplprovider-${VERSION}.jar"/>
+
+
+
+ <!-- copy provider and policy class mof-->
+ <copy todir="${TMP}/imperius-cimsplprovider${VERSION}/mofs">
+ <fileset dir="${IMPERIUS_CIMSPL_DIR}/resources/mofs">
+ <exclude name="testElement.mof"/>
+ </fileset>
+ </copy>
+ <!-- copy bat/sh scripts and readmes-->
+ <copy todir="${TMP}/imperius-cimsplprovider${VERSION}">
+ <fileset dir="${IMPERIUS_CIMSPL_DIR}/resources/">
+ <include name="*.txt"/>
+ <include name="*.bat"/>
+ <include name="*.sh"/>
+ </fileset>
+ </copy>
+
+ <!-- copy javadocs -->
+
+ <copy todir="${TMP}/imperius-cimsplprovider${VERSION}/docs/javadoc" failonerror="true" overwrite="true">
+ <fileset dir="${IMPERIUS_JAVADOC_DIR}"/>
+ </copy>
+
+ <!-- copy build log file -->
+ <copy file="${IMPERIUS_LOGGING_FILE}" todir="${TMP}/imperius-cimsplprovider${VERSION}"/>
+
+ <!-- copy in the notice -->
+ <copy todir="${TMP}/imperius-cimsplprovider${VERSION}" file="${APACHE_NOTICE_FILE}"/>
+
+ <!-- copy in the license -->
+ <copy todir="${TMP}/imperius-cimsplprovider${VERSION}" file="${APACHE_LICENSE_FILE}"/>
+
+ <!-- zip the contents -->
+
+ <zip destfile="${IMPERIUS_DIST}/imperius-cimsplprovider${VERSION}-bin.zip" basedir="${TMP}"/>
+
+ <!-- tar gz the contents -->
+ <tar destfile="${IMPERIUS_DIST}/imperius-cimsplprovider${VERSION}-bin.tar.gz" basedir="${TMP}" compression="gzip"/>
+
+ <!-- delete tmp dir -->
+ <delete dir="${TMP}"/>
+
+ </target>
+
<!-- PACKAGE CIMSPL CLIENT SIDE PROVIDER -->
- <!-- package java spl provider -->
- <target name="package.cimsplclientsideprovider" description="creates JavaSPLProvider.zip">
+ <target name="package.cimsplclientsideprovider" description="creates cimsplclientsideprovider.zip">
<echo message="Creating CIMSPLClientSideProvider.zip"/>
<delete dir="${TMP}"/>
@@ -508,11 +655,18 @@
</target>
+ <!-- PACKAGE CIMSPL CLIENT SIDE PROVIDER -->
+ <target name="package.cimspl.clientside.runtime" depends="build.cimspl.clientside.runtime">
+ <antcall target="package.cimsplclientsideprovider" />
+ </target>
+
<!-- PACKAGE CIMSPL RUNTIME -->
<target name="package.cimspl.runtime" depends="build.cimspl.runtime">
- <antcall target="package.cimsplclientsideprovider" />
+
+ <antcall target="package.cimsplprovider"/>
+ <antcall target="package.cimsplsamples"/>
<!-- get maven to clean up the generated files -->
<exec executable="${MAVEN_EXECUTABLE}" searchpath="true" dir="${IMPERIUS_SVN_MODULES}" failonerror="true">
@@ -521,7 +675,47 @@
</exec>
</target>
- <!-- BUILD THE CIMSPL PROVIDERS-->
+ <!-- BUILD CIMSPL CLIENT SIDE PROVIDER -->
+ <target name="build.cimspl.clientside.runtime">
+ <!-- get maven to clean up any existing generated files -->
+ <exec executable="${MAVEN_EXECUTABLE}" searchpath="true" dir="${IMPERIUS_SVN_MODULES}" failonerror="true">
+ <arg line="clean -Dbuild=cimspl-clientside-runtime"/>
+ <env key="MAVEN_TERMINATE_CMD" value="on" />
+ </exec>
+
+ <!-- call maven directly -->
+ <exec executable="${MAVEN_EXECUTABLE}" searchpath="true" dir="${IMPERIUS_SVN_MODULES}" failonerror="true">
+ <arg line="-ff -e -Dbuild=cimspl-clientside-runtime"/>
+ <env key="MAVEN_TERMINATE_CMD" value="on" />
+ </exec>
+
+ <!-- copy in the notice -->
+ <copy todir="${TEMP_BIN_DIST_DIR}" file="${APACHE_NOTICE_FILE}"/>
+
+ <!-- copy in the license -->
+ <copy todir="${TEMP_BIN_DIST_DIR}" file="${APACHE_LICENSE_FILE}"/>
+
+ <!-- create the javadoc -->
+ <javadoc destdir="${IMPERIUS_JAVADOC_DIR}" useexternalfile="yes" failonerror="true">
+ <fileset dir="${TEMP_SRC_DIST_DIR}">
+ <include name="**/external/**"/>
+ <include name="**/manager/PolicyManager.java"/>
+ <include name="**/manager/PolicyDataStore.java"/>
+ <include name="**/manager/PolicyParser.java"/>
+ <include name="**/manager/PolicyRepository.java"/>
+ <include name="**/manager/PolicyEvaluator.java"/>
+ <include name="**/CIM_SPLPolicyRuleClientProvider.java"/>
+ <exclude name="**/*.xml"/>
+ <exclude name="**/*.class"/>
+ <exclude name="**/*.bat"/>
+ <exclude name="**/*.sh"/>
+ </fileset>
+ </javadoc>
+
+ </target>
+
+
+ <!-- BUILD THE CIMSPL PROVIDER-->
<target name="build.cimspl.runtime">
<!-- get maven to clean up any existing generated files -->
<exec executable="${MAVEN_EXECUTABLE}" searchpath="true" dir="${IMPERIUS_SVN_MODULES}" failonerror="true">
@@ -550,7 +744,7 @@
<include name="**/manager/PolicyParser.java"/>
<include name="**/manager/PolicyRepository.java"/>
<include name="**/manager/PolicyEvaluator.java"/>
- <include name="**/CIM_SPLPolicyRuleClientProvider.java"/>
+ <include name="**/CIM_SPLPolicyRuleProvider.java"/>
<exclude name="**/*.xml"/>
<exclude name="**/*.class"/>
<exclude name="**/*.bat"/>
@@ -604,11 +798,17 @@
</target>
+
+
<target name="javaspl.runtime" depends="src.dist.all,build.javaspl.runtime,package.javaspl.runtime,cleanup">
<record name="${LOG_FILE}" append="yes" action="stop"/>
</target>
<target name="cimspl.runtime" depends="src.dist.all,build.cimspl.runtime,package.cimspl.runtime,cleanup">
+ <record name="${LOG_FILE}" append="yes" action="stop"/>
+ </target>
+
+ <target name="cimspl.clientside.runtime" depends="src.dist.all,build.cimspl.clientside.runtime,package.cimspl.clientside.runtime,cleanup">
<record name="${LOG_FILE}" append="yes" action="stop"/>
</target>
Added: incubator/imperius/trunk/cimspl-samples/pom.xml
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/pom.xml?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/pom.xml (added)
+++ incubator/imperius/trunk/cimspl-samples/pom.xml Wed Feb 20 12:40:03 2008
@@ -0,0 +1,38 @@
+<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>cimspl-samples</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>cimspl-samples</name>
+ <dependencies>
+ <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>
+ <dependency>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.1</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.1</version>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: incubator/imperius/trunk/cimspl-samples/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/cimspl-samples/resources/README.txt
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/README.txt?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/README.txt (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/README.txt Wed Feb 20 12:40:03 2008
@@ -0,0 +1,99 @@
+
+ CIM-SPL Samples
+
+
+
+ What is it?
+
+-----------
+
+A command line utility to manage CIM-SPL policies on a CIM Server like
+OpenPegasus.
+Several samples illustrating the use of the CIM-SPL language.
+
+
+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
+
+
+
+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 the cimmof
+command.
+3. Set environment variable 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/cimspl-samples/resources/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.bat
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.bat?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.bat (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.bat Wed Feb 20 12:40:03 2008
@@ -0,0 +1,3 @@
+echo "CIMSPL Client"
+set CLASSPATH=%CLASSPATH%;lib/cimspl-client-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/cimspl-samples/resources/cimsplcmdline.bat
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.sh
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.sh?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.sh (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.sh Wed Feb 20 12:40:03 2008
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "CIMSPL Client"
+java -classpath lib/cimspl-client-1.0.0.jar:$SBLIM_HOME/sblimCIMClient-1.0.0.jar org.apache.imperius.cimspl.client.TestClient $1 $2 $3
Propchange: incubator/imperius/trunk/cimspl-samples/resources/cimsplcmdline.sh
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/cimspl-samples/resources/samples/mofs/testElement.mof
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/samples/mofs/testElement.mof?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/samples/mofs/testElement.mof (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/samples/mofs/testElement.mof Wed Feb 20 12:40:03 2008
@@ -0,0 +1,247 @@
+//////////////////////////////////////////////////////////////////////////
+// * 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/cimspl-samples/resources/samples/policies/CascadedPolicyInvocation.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/samples/policies/CascadedPolicyInvocation.spl?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/samples/policies/CascadedPolicyInvocation.spl (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/samples/policies/CascadedPolicyInvocation.spl Wed Feb 20 12:40:03 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/cimspl-samples/resources/samples/policies/ComplexPolicy.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/samples/policies/ComplexPolicy.spl?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/samples/policies/ComplexPolicy.spl (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/samples/policies/ComplexPolicy.spl Wed Feb 20 12:40:03 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/cimspl-samples/resources/samples/policies/GroupSample.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/samples/policies/GroupSample.spl?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/samples/policies/GroupSample.spl (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/samples/policies/GroupSample.spl Wed Feb 20 12:40:03 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/cimspl-samples/resources/samples/policies/InvokeMethodSample.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/samples/policies/InvokeMethodSample.spl?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/samples/policies/InvokeMethodSample.spl (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/samples/policies/InvokeMethodSample.spl Wed Feb 20 12:40:03 2008
@@ -0,0 +1,38 @@
+//////////////////////////////////////////////////////////////////////////
+// * 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/cimspl-samples/resources/samples/policies/MacroSample.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/samples/policies/MacroSample.spl?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/samples/policies/MacroSample.spl (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/samples/policies/MacroSample.spl Wed Feb 20 12:40:03 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/cimspl-samples/resources/samples/policies/MultiplePolicySample.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/samples/policies/MultiplePolicySample.spl?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/samples/policies/MultiplePolicySample.spl (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/samples/policies/MultiplePolicySample.spl Wed Feb 20 12:40:03 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/cimspl-samples/resources/samples/policies/SimplePolicy1.0.1.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/samples/policies/SimplePolicy1.0.1.spl?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/samples/policies/SimplePolicy1.0.1.spl (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/samples/policies/SimplePolicy1.0.1.spl Wed Feb 20 12:40:03 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/cimspl-samples/resources/samples/policies/testElement1Policy.spl
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/resources/samples/policies/testElement1Policy.spl?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/resources/samples/policies/testElement1Policy.spl (added)
+++ incubator/imperius/trunk/cimspl-samples/resources/samples/policies/testElement1Policy.spl Wed Feb 20 12:40:03 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/cimspl-samples/src/main/java/org/apache/imperius/cimspl/client/TestClient.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/cimspl-samples/src/main/java/org/apache/imperius/cimspl/client/TestClient.java?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/cimspl-samples/src/main/java/org/apache/imperius/cimspl/client/TestClient.java (added)
+++ incubator/imperius/trunk/cimspl-samples/src/main/java/org/apache/imperius/cimspl/client/TestClient.java Wed Feb 20 12:40:03 2008
@@ -0,0 +1,628 @@
+/*
+ * 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.
+ */
+package org.apache.imperius.cimspl.client;
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.sblim.wbem.cim.CIMDataType;
+import org.sblim.wbem.cim.CIMException;
+import org.sblim.wbem.cim.CIMInstance;
+import org.sblim.wbem.cim.CIMNameSpace;
+import org.sblim.wbem.cim.CIMObjectPath;
+import org.sblim.wbem.cim.CIMProperty;
+import org.sblim.wbem.cim.CIMValue;
+import org.sblim.wbem.client.CIMClient;
+import org.sblim.wbem.client.PasswordCredential;
+import org.sblim.wbem.client.UserPrincipal;
+
+
+
+public class TestClient
+{
+
+ public static final int INVALID_OPERATION = -1;
+ public static final int LIST_POLICY = 0;
+ public static final int EXECUTE_POLICY = 1;
+ public static final int CREATE_POLICY = 2;
+ public static final int DELETE_POLICY = 3;
+ public static final int MODIFY_POLICY = 4;
+ public static final int LISTALLNAMES_POLICY = 5;
+ public static final int LISTALL_POLICY = 6;
+ private static String USER = "";
+ private static String PWD = "";
+ private static int PORT = 5988;
+ private static String SERVER = "localhost";
+ private static String NAMESPACE = "root/cimv2";
+ private static String POLICY_NAME;
+ private static String POLICY_PATH;
+ private CIMClient _cimClient;
+
+ public TestClient() throws CIMException
+ {
+ _establishConnection();
+ }
+
+ public TestClient(String user, String pwd,
+ int port, String server, String ns,
+ int operation) throws CIMException
+ {
+
+ _establishConnection();
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ int operation = _getInputs(args);
+ TestClient ptc = null;
+
+ try
+ {
+ try
+ {
+ ptc = new TestClient(USER,PWD,PORT,SERVER,NAMESPACE,operation);
+ }
+ catch (Exception e)
+ {
+ System.err.println("Error: " + e.getMessage());
+ System.exit(0);
+
+ }
+ switch (operation)
+ {
+ case CREATE_POLICY :
+ {
+
+ System.out.println("create policy :" + POLICY_NAME
+ + " path " + POLICY_PATH);
+ ptc.createPolicy(POLICY_PATH, POLICY_NAME);
+ }
+ break;
+ case LIST_POLICY :
+ {
+
+ System.out.println("list policy" + POLICY_NAME);
+ ptc.listPolicy(POLICY_NAME);
+ }
+ break;
+ case MODIFY_POLICY :
+ {
+
+ System.out.println("modify policy" + POLICY_NAME
+ + " path " + POLICY_PATH);
+ ptc.modifyPolicy(POLICY_PATH, POLICY_NAME);
+ }
+ break;
+ case LISTALL_POLICY :
+ {
+ ptc.listAllPolicies();
+ System.out.println("list all policies" );
+ }
+ break;
+ case LISTALLNAMES_POLICY :
+ {
+ ptc.listAllPolicyNames();
+ System.out.println("list all names");
+ }
+ break;
+ case DELETE_POLICY :
+ {
+ System.out.println("delete policy" + POLICY_NAME);
+ ptc.deletePolicy(POLICY_NAME);
+
+ }
+ break;
+ case EXECUTE_POLICY :
+ {
+ System.out.println("exec policy" + POLICY_NAME);
+ ptc.executePolicy(POLICY_NAME);
+
+ }
+
+ break;
+ case INVALID_OPERATION :
+ _throwUsage();
+ break;
+
+ }
+ ptc.shutdown();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Error: " + e.getMessage());
+
+
+ }
+ /*finally
+ {
+ ptc.shutdown();
+ }*/
+
+ }
+
+ public void shutdown()
+ {
+ try
+ {
+ if(_cimClient != null)
+ {
+ _cimClient.close();
+ }
+ }
+ catch(Exception e)
+ {
+ System.err.println("Exception closing cimclient connection");
+ }
+ }
+
+ public void executePolicy(String policyName) throws CIMException
+ {
+ CIMValue result = null;
+ CIMObjectPath cimObjectPath = new CIMObjectPath("CIM_SPLPolicyRule");
+ CIMNameSpace clientNameSpace = _cimClient.getNameSpace();
+ cimObjectPath.setNameSpace(clientNameSpace.getNameSpace());
+ cimObjectPath.setHost(clientNameSpace.getHost());
+ System.out.println("cimObjectPath : "+cimObjectPath.toString());
+
+ CIMDataType strType = new CIMDataType(CIMDataType.STRING);
+ CIMValue policyNameCimValue = new CIMValue (policyName,strType);
+
+ cimObjectPath.addKey("PolicyRuleName", policyNameCimValue);
+ if(_cimClient.getInstance(cimObjectPath, true, true, true, null) != null)
+ {
+ System.out.println("before invoke method, cimObjectPath : "+cimObjectPath.toString());
+
+ result = _cimClient.invokeMethod(cimObjectPath, "evaluatePolicy",
+ (Vector)null, (Vector)null);
+
+// result = _cimClient.invokeMethod(cimObjectPath, "evaluatePolicy",
+// new Vector(), new Vector());
+
+ System.out.println("Evaluated Policy with result " + result.toString());
+ }
+ else
+ {
+ System.err.println("Instance does not exist" + cimObjectPath);
+ }
+
+
+ }
+
+ public void deletePolicy(String policyName) throws CIMException
+ {
+ CIMObjectPath cimObjectPath = new CIMObjectPath("CIM_SPLPolicyRule");
+ CIMNameSpace clientNameSpace = _cimClient.getNameSpace();
+ cimObjectPath.setNameSpace(clientNameSpace.getNameSpace());
+ cimObjectPath.setHost(clientNameSpace.getHost());
+
+ CIMDataType strType = new CIMDataType(CIMDataType.STRING);
+ CIMValue policyNameCimValue = new CIMValue (policyName,strType);
+
+ cimObjectPath.addKey("PolicyRuleName", policyNameCimValue);
+
+ _cimClient.deleteInstance(cimObjectPath);
+
+ }
+
+ public void listAllPolicyNames() throws CIMException
+ {
+ CIMObjectPath cop = new CIMObjectPath("CIM_SPLPolicyRule");
+ cop.setNameSpace("root/cimv2");
+ Enumeration enm = _cimClient.enumerateInstanceNames(cop);
+
+ while (enm.hasMoreElements ())
+ {
+ CIMObjectPath cimObjectPath = (CIMObjectPath)enm.nextElement ();
+
+ System.out.println("----------------------------");
+ System.out.println("Policy : " + cimObjectPath);
+ System.out.println("----------------------------");
+ }
+
+
+ }
+
+ public void listAllPolicies() throws CIMException
+ {
+ CIMObjectPath cop = new CIMObjectPath("CIM_SPLPolicyRule");
+ cop.setNameSpace("root/cimv2");
+ Enumeration enm = _cimClient.enumerateInstances(cop, true, true, true, true, null);
+ while (enm.hasMoreElements ())
+ {
+ CIMInstance cimInstance = (CIMInstance)enm.nextElement ();
+ CIMProperty cimProperty = cimInstance.getProperty("PolicyString");
+ CIMValue policyStringCimValue = cimProperty.getValue();
+ String policyString = policyStringCimValue.toString();
+
+ CIMProperty cimProperty2 = cimInstance.getProperty("PolicyRuleName");
+ CIMValue policyRuleCimValue = cimProperty2.getValue();
+ String policyName = policyRuleCimValue.toString();
+ System.out.println("----------------------------");
+ System.out.println("Policy Name: " + policyName);
+ System.out.println("Policy String: " + policyString);
+ System.out.println("----------------------------");
+ }
+
+
+
+ }
+
+ public void modifyPolicy(String policyPath, String policyName) throws CIMException
+ {
+ String policyString = _readPolicyString(policyPath,policyName);
+ boolean localOnly = true;
+ Vector kvp = new Vector ();
+ CIMDataType strType = new CIMDataType(CIMDataType.STRING);
+ CIMValue policyStringCimValue = new CIMValue (policyString,strType);
+
+ kvp.addElement (new CIMProperty ("PolicyRuleName", new CIMValue (policyName,strType)));
+
+ CIMObjectPath cop = new CIMObjectPath ("CIM_SPLPolicyRule", kvp);
+ cop.setNameSpace ("root/cimv2");
+
+ CIMInstance cimInstance = _cimClient.getInstance(cop, localOnly);
+
+
+ cimInstance.setProperty("PolicyString", policyStringCimValue);
+
+
+ _cimClient.setInstance(cop, cimInstance, true, null);
+
+
+ }
+
+ public String listPolicy(String policyName) throws CIMException
+ {
+ boolean localOnly = true;
+ CIMObjectPath cop=new CIMObjectPath("CIM_SPLPolicyRule","root/cimv2");
+
+ CIMDataType strType = new CIMDataType(CIMDataType.STRING);
+ CIMValue policyNameCimValue = new CIMValue (policyName,strType);
+
+ cop.addKey("PolicyRuleName", policyNameCimValue);
+
+ CIMInstance cimInstance = _cimClient.getInstance(cop, localOnly);
+
+ CIMProperty cimProperty = cimInstance.getProperty("PolicyString");
+ CIMValue policyStringCimValue = cimProperty.getValue();
+ String policyString = policyStringCimValue.toString();
+ System.out.println("Policy String: " + policyString);
+ return policyString;
+
+
+ }
+
+ public void createPolicy(String policyPath, String policyName) throws CIMException
+ {
+ System.out.println("createPolicy** : "+policyPath+" "+policyName) ;
+ String policyString = _readPolicyString(policyPath,policyName);
+
+ Vector kvp = new Vector ();
+
+ CIMDataType strType = new CIMDataType(CIMDataType.STRING);
+ CIMValue policyNameCimValue = new CIMValue (policyName,strType);
+
+ CIMValue policyStringCimValue = new CIMValue(policyString,strType);
+
+ kvp.addElement (new CIMProperty ("PolicyRuleName", policyNameCimValue));
+ kvp.addElement (new CIMProperty ("PolicyString", policyStringCimValue));
+
+ CIMObjectPath cop = new CIMObjectPath ("CIM_SPLPolicyRule", kvp);
+ cop.setNameSpace ("root/cimv2");
+
+ CIMInstance ci = new CIMInstance (cop);
+ ci.setObjectPath (cop);
+ CIMObjectPath returnpath=_cimClient.createInstance(ci.getObjectPath(), ci);
+ System.out.println("returnpath :"+returnpath);
+
+
+ }
+
+ static int _getInputs(String[] args)
+ {
+ int operation = INVALID_OPERATION;
+ if (args.length < 1)
+ {
+ _throwUsage();
+ }
+ for (int i=0; i < args.length; i++)
+ {
+ if ( args[i].equalsIgnoreCase("-u"))
+ {
+
+ if ( i + 1 < args.length )
+ {
+ USER=args[i+1];
+ i++;
+ }
+ else
+ {
+ System.err.println("A user name is required");
+ _throwUsage();
+ }
+
+
+ }
+ else if (args[i].equalsIgnoreCase("-pwd"))
+ {
+ if (i+1 < args.length)
+ {
+ PWD = args[i+1];
+ i++;
+ }
+ else
+ {
+ System.err.println("A pwd is required");
+ _throwUsage();
+ }
+ }
+ else if (args[i].equalsIgnoreCase("-n"))
+ {
+
+ if (i +1 < args.length)
+ {
+ NAMESPACE = args[i+1];
+ i++;
+ }
+ else
+ {
+ System.err.println("A namespace is required");
+ _throwUsage();
+ }
+ }
+ else if (args[i].equalsIgnoreCase("-s"))
+ {
+
+ if (i +1 < args.length)
+ {
+ SERVER = args[i+1];
+ i++;
+ }
+ else
+ {
+ System.err.println("A servername is required");
+ _throwUsage();
+ }
+ }
+ else if (args[i].equalsIgnoreCase("-p"))
+ {
+
+ if (i+1 < args.length)
+ {
+ PORT = Integer.parseInt(args[i+1]);
+ i++;
+ }
+ else
+ {
+ System.err.println("A servername is required");
+ _throwUsage();
+ }
+ }
+ else if (args[i].equalsIgnoreCase("-l"))
+ {
+
+ if (i+1 < args.length)
+ {
+ POLICY_NAME = args[i+1];
+ operation = LIST_POLICY;
+ break;
+
+ }
+ else
+ {
+
+ _throwUsage();
+ }
+ }
+ else if (args[i].equalsIgnoreCase("-x"))
+ {
+ if (i + 1 < args.length)
+ {
+ POLICY_NAME = args[i+1];
+ operation = EXECUTE_POLICY;
+ break;
+
+
+ }
+ else
+ {
+ _throwUsage();
+ }
+
+ }
+ else if (args[i].equalsIgnoreCase("-m"))
+ {
+ if ((i+2) < args.length)
+ {
+ POLICY_PATH = args[i+1];
+ POLICY_NAME = args[i+2];
+ operation = MODIFY_POLICY;
+ break;
+ }
+ else
+ {
+ _throwUsage();
+ }
+
+ }
+ else if (args[i].equalsIgnoreCase("-d"))
+ {
+
+ if (i+1 < args.length)
+ {
+ POLICY_NAME = args[i+1];
+ operation = DELETE_POLICY;
+ break;
+ }
+ else
+ {
+ _throwUsage();
+ }
+ }
+ else if (args[i].equalsIgnoreCase("-i"))
+ {
+ operation = LISTALL_POLICY;
+ break;
+ }
+ else if (args[i].equalsIgnoreCase("-a"))
+ {
+ operation = LISTALLNAMES_POLICY;
+ break;
+
+ }
+ else if (args[i].equalsIgnoreCase("-c"))
+ {
+ if ((i+2) <args.length)
+ {
+ POLICY_PATH = args[i+1];
+ POLICY_NAME = args[i+2];
+ operation = CREATE_POLICY;
+ break;
+
+ }
+ else
+ {
+ _throwUsage();
+ }
+ }
+ else
+ {
+ _throwUsage();
+ }
+ }
+ if(operation == INVALID_OPERATION)
+ {
+ _throwUsage();
+ }
+
+ return operation;
+ }
+
+ private static void _throwUsage()
+ {
+ System.out.println(" Usage: PolicyClient ");
+ System.out.println( " [-s <server name>] [-p <port>] [-u <user>] [-p <pwd>] ");
+ System.out.println( " -l <policy name> OR " );
+ System.out.println( " -c <policy path> <policy name> OR " );
+ System.out.println( " -m <policy path> <policy name> OR" );
+ System.out.println( " -d <policy name> OR" );
+ System.out.println( " -x <policy name> OR" );
+ System.out.println( " -i OR" );
+ System.out.println( " -a " );
+ System.exit(0);
+
+
+ }
+
+ private String _readPolicyString(String path, String policyName)
+ {
+ StringBuffer policy = new StringBuffer();
+ if(!path.endsWith("/"))
+ {
+ path = path + "/" + policyName;
+
+ }
+ else {
+ path = path + policyName;
+ }
+ //path.concat(policyName);
+ if(!path.endsWith(".spl"))
+ {
+ path = path + ".spl";
+
+ }
+ try
+ {
+ System.out.println("path="+path);
+ FileReader input = new FileReader(path);
+
+ BufferedReader bufRead = new BufferedReader(input);
+ String line; // String that holds current file line
+ int count = 0; // Line number of count
+ line = bufRead.readLine();
+ policy.append(line);
+ policy.append("\n");
+ count++;
+ while (line != null)
+ {
+ line = bufRead.readLine();
+ if(line != null){
+ policy.append(line);
+ policy.append("\n");
+ }
+ count++;
+ }
+
+ bufRead.close();
+
+ }
+ catch (FileNotFoundException e)
+ {
+ System.err.println("Error Reading file");
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ System.err.println("Error Reading file");
+ e.printStackTrace();
+ }
+ System.out.println(policy.toString());
+ return policy.toString();
+
+
+ }
+ void _establishConnection() throws CIMException
+
+ {
+ String url="http://"+SERVER+":"+PORT;
+
+
+
+ // *****************************
+ // 1. Create user credentials
+ // *****************************
+ UserPrincipal userPr = new UserPrincipal(USER);
+ char [] pwdCharArray = PWD.toCharArray();
+ PasswordCredential pwCred = new PasswordCredential(pwdCharArray);
+
+ // *****************************
+ // 2. Set NameSpace
+ // - URL is set like: http(s)://<IP>:Port
+ // - Namespace does not need to be specified in COPs if set in this constuctor
+ // - There is no server authentication being done. Thus: No need for a truststore
+ // *****************************
+ CIMNameSpace nameSpace = new CIMNameSpace(url,NAMESPACE);
+
+ // *****************************
+ // 3. Create CIM Client
+ // *****************************
+ _cimClient = new CIMClient(nameSpace,userPr,pwCred);
+
+ System.out.println("Established Connection");
+ }
+
+
+
+}
Propchange: incubator/imperius/trunk/cimspl-samples/src/main/java/org/apache/imperius/cimspl/client/TestClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIM_SPLPolicyRuleClientProvider.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIM_SPLPolicyRuleClientProvider.java?rev=629608&r1=629607&r2=629608&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIM_SPLPolicyRuleClientProvider.java (original)
+++ incubator/imperius/trunk/imperius-cimsplclientsideprovider/src/main/java/org/apache/imperius/cimspl/client/CIM_SPLPolicyRuleClientProvider.java Wed Feb 20 12:40:03 2008
@@ -1,4 +1,21 @@
-//(c) Copyright IBM Corp. 2007
+/*
+ * 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 Prashant Baliga <pr...@in.ibm.com>
Added: incubator/imperius/trunk/imperius-cimsplprovider/pom.xml
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplprovider/pom.xml?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplprovider/pom.xml (added)
+++ incubator/imperius/trunk/imperius-cimsplprovider/pom.xml Wed Feb 20 12:40:03 2008
@@ -0,0 +1,23 @@
+<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-cimsplprovider</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>imperius-cimsplprovider</name>
+ <dependencies>
+ <dependency>
+ <groupId>imperius</groupId>
+ <artifactId>imperius-splcore</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>openpegasus</groupId>
+ <artifactId>jmpiimpl</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
Propchange: incubator/imperius/trunk/imperius-cimsplprovider/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/imperius-cimsplprovider/resources/README.txt
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplprovider/resources/README.txt?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplprovider/resources/README.txt (added)
+++ incubator/imperius/trunk/imperius-cimsplprovider/resources/README.txt Wed Feb 20 12:40:03 2008
@@ -0,0 +1,132 @@
+
+ CIM-SPL Provider
+
+
+
+ What is it?
+
+-----------
+
+CIM-SPL Provider is a CIM binding for Apache Imperius.
+A CIM binding allows the Imperius engine to interact with objects in
+the CIM environment.
+The CIM-SPL Provider is registered as an instance and method provider into
+a CIM Server. The CIM-SPL 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. Install the JMPIImpl.jar found in <PEGASUS_HOME>/lib folder using the following command
+
+mvn install:install-file -Dfile=<PEGASUS_HOME>/JMPIImpl.jar -DgroupId=openpegasus \
+ -DartifactId=jmpiimpl -Dversion=1.0.0 -Dpackaging=jar
+
+3. In the top level directory issue the command
+
+ant cimspl.runtime
+
+Deploy
+-------
+The CIM-SPL Provider needs to be deployed into OpenPegasus before use. To
+deploy the provider do the following:
+
+1. Build OpenPegasus with JMPI enabled. Refer to the OpenPegasus documentation for more
+information.
+
+2. Unzip the generated imperius-cimsplprovider-1.0.0.zip into a temporary location <TEMP>
+
+3. Copy the contents of <TEMP>/imperius-cimsplprovider-1.0.0/lib to <PEGASUS_HOME>/lib
+
+4. Copy the <ANTLR_HOME>/lib/antlr.jar to <PEGASUS_HOME>/lib
+
+5. Add the above jars to the CLASSPATH and LD_LIBRARY_PATH variables as follows:
+
+set LD_LIBRARY_PATH=%LD_LIBRARY_PATH%;%PEGASUS_HOME%\lib\imperius-cimsplprovider-1.0.0.jar;
+set LD_LIBRARY_PATH=%LD_LIBRARY_PATH%;%PEGASUS_HOME%\lib\imperius-splcore-1.0.0.jar;
+set LD_LIBRARY_PATH=%LD_LIBRARY_PATH%;%PEGASUS_HOME%\lib\imperius-cimsplcommon-1.0.0.jar;
+set LD_LIBRARY_PATH=%LD_LIBRARY_PATH%;%PEGASUS_HOME%\lib\antlr.jar;
+
+set CLASSPATH=%CLASSPATH%;%PEGASUS_HOME%\lib\imperius-cimsplprovider-1.0.0.jar;
+set CLASSPATH=%CLASSPATH%;%PEGASUS_HOME%\lib\imperius-splcore-1.0.0.jar;
+set CLASSPATH=%CLASSPATH%;%PEGASUS_HOME%\lib\imperius-cimsplcommon-1.0.0.jar;
+set CLASSPATH=%CLASSPATH%;%PEGASUS_HOME%\lib\antlr.jar;
+
+6. Copy <TEMP>/imperius-cimsplprovider-1.0.0/customexpressions.properties to <PEGASUS_ROOT>
+
+7. Start the CIM Server
+
+> cimserver
+
+8. Register the CIM-SPL Policy class as follows
+
+> cimmof -n root/cimv2 <TEMP>/imperius-cimsplprovider-1.0.0/CIM_SPLPolicyRule.mof
+
+9. Register the CIM-SPL Provider as follows
+
+> cimmof -n root/PG_InterOp <TEMP>/imperius-cimsplprovider-1.0.0/CIM_SPLPolicyRuleProviderR.mof
+
+9. Make sure the provider is installed and operational by running the following command:
+
+> cimcli -n root/cimv2 ei CIM_SPLPolicyRule
+
+
+
+ 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 cimspl-samples project.
+
+
+
+
+ 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-cimsplprovider/resources/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRule.mof
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRule.mof?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRule.mof (added)
+++ incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRule.mof Wed Feb 20 12:40:03 2008
@@ -0,0 +1,39 @@
+//////////////////////////////////////////////////////////////////////////
+// * 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 Prashant Baliga <pr...@in.ibm.com>
+// *
+// */
+#pragma locale("en_US")
+
+[Version ( "2.7.1" ), Description ("CIM_SPLPolicyRule")]
+class CIM_SPLPolicyRule : CIM_PolicyRule {
+String PolicyString;
+uint32 evaluatePolicy([in] CIMObjectPath ref arrayOfInstances[]);
+
+
+};
+
+
+
+
+
+
+
+
Added: incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRuleProviderR.mof
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRuleProviderR.mof?rev=629608&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRuleProviderR.mof (added)
+++ incubator/imperius/trunk/imperius-cimsplprovider/resources/mofs/CIM_SPLPolicyRuleProviderR.mof Wed Feb 20 12:40:03 2008
@@ -0,0 +1,51 @@
+//////////////////////////////////////////////////////////////////////////
+// * 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 Prashant Baliga <pr...@in.ibm.com>
+// *
+// */
+instance of PG_ProviderModule
+{
+ Name = "CIM_SPLPolicyRuleProviderModule";
+ Location = "imperius-cimsplprovider-1.0.0.jar:org/apache/imperius/cimspl/CIM_SPLPolicyRuleProvider";
+ Vendor = "OpenPegasus";
+ Version = "2.0.0";
+ InterfaceType = "JMPIExperimental";
+ InterfaceVersion = "0.0.1";
+};
+
+instance of PG_Provider
+{
+ ProviderModuleName = "CIM_SPLPolicyRuleProviderModule";
+ Name = "CIM_SPLPolicyRuleProvider";
+};
+
+instance of PG_ProviderCapabilities
+{
+ ProviderModuleName = "CIM_SPLPolicyRuleProviderModule";
+ ProviderName = "CIM_SPLPolicyRuleProvider";
+ CapabilityID = "1";
+ ClassName = "CIM_SPLPolicyRule";
+ Namespaces = {"root/cimv2"};
+ ProviderType = { 2,5 }; // Instance provider,method provider
+ SupportedProperties = NULL;
+ SupportedMethods = NULL;
+
+};
+