Package org.apache.imperius.javaspl

Examples of org.apache.imperius.javaspl.Java_SPLPolicyRuleProvider


    public static void _test(String policyName, Map objMap)
    {
        try
        {
           
            Java_SPLPolicyRuleProvider jspl = Java_SPLPolicyRuleProvider.getInstance();
            String aFile = policyFolder + policyName + ".spl";
            //System.out.println("starting test");
            StringBuffer contents = new StringBuffer();
            BufferedReader input = null;
            try
            {
                input = new BufferedReader( new FileReader(aFile) );
                String line = null;
            
                while (( line = input.readLine()) != null)
                {
                    contents.append(line);
                    contents.append(System.getProperty("line.separator"));
                }
                input.close();
            }
            catch (FileNotFoundException ex)
            {
              ex.printStackTrace();
            }
            catch (IOException ex){
              ex.printStackTrace();
            }
            try
            {
                jspl.deletePolicy(policyName);
            }
            catch(Exception e)
            {
               
            }
           
            boolean createReturn=jspl.createPolicy(policyName, contents.toString());
            System.out.println("Policy Created : " + policyName +createReturn);
            System.out.println("");
            Object result = jspl.executePolicy(policyName, objMap);
            System.out.println("Result is " + result);
        }  
        catch (SPLException e)
        {               // TODO Auto-generated catch block
            e.printStackTrace();
View Full Code Here


        {
            if(args.length == 1)
            {
                policyToExecute = args[0];
            }
            Java_SPLPolicyRuleProvider jspl = Java_SPLPolicyRuleProvider.getInstance();
            String aFile = "policies/" + policyToExecute + ".spl";
            //System.out.println("starting test");
            StringBuffer contents = new StringBuffer();
            BufferedReader input = null;
            try
            {
                input = new BufferedReader( new FileReader(aFile) );
                String line = null;
            
                while (( line = input.readLine()) != null)
                {
                    contents.append(line);
                    contents.append(System.getProperty("line.separator"));
                }
                input.close();
            }
            catch (FileNotFoundException ex)
            {
              ex.printStackTrace();
            }
            catch (IOException ex){
              ex.printStackTrace();
            }
            try
            {
                jspl.deletePolicy(policyToExecute);
            }
            catch(Exception e)
            {
               
            }
           
            boolean createReturn=jspl.createPolicy(policyToExecute, contents.toString());
            System.out.println("Policy Created : " + policyToExecute +createReturn);
            System.out.println("");
           
            Map objMap = new Hashtable();
           
           /* List instanceInfoList = new ArrayList();
           
            InstanceInfo ii1 = new InstanceInfo("system1",system1);
            instanceInfoList.add(ii1);     
       
            objMap.put("org.apache.imperius.javaspl.samples.windowscomputersystem.WindowsComputerSystem", instanceInfoList);*/
            objMap.put("system1", system1);
           
             
            Object result = jspl.executePolicy(policyToExecute, objMap);
           System.out.println("Result is " + result);
           
        }
        catch (SPLException e)
        {
View Full Code Here

    public static void testPolicy(String policyName, Map objMap)
    {
        try
        {
            Java_SPLPolicyRuleProvider jspl = Java_SPLPolicyRuleProvider.getInstance();
            String aFile = policyFolder + policyName + ".spl";
            StringBuffer contents = new StringBuffer();
            BufferedReader input = null;
            try
            {
                input = new BufferedReader( new FileReader(aFile) );
                String line = null;
                while (( line = input.readLine()) != null)
                {
                    contents.append(line);
                    contents.append(System.getProperty("line.separator"));
                }
                input.close();
            }
            catch (FileNotFoundException ex)
            {
              ex.printStackTrace();
            }
            catch (IOException ex){
              ex.printStackTrace();
            }
            try
            {
                jspl.deletePolicy(policyName);
            }
            catch(Exception e)
            {
               
            }
           
            boolean createReturn = jspl.createPolicy(policyName, contents.toString());
            System.out.println("Policy Created : " + policyName + " " + createReturn);

            System.out.println("");
           
            Object result = jspl.executePolicy(policyName, objMap);
            System.out.println("Result is " + result);
        }  
        catch (SPLException e)
        {
            e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.imperius.javaspl.Java_SPLPolicyRuleProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.