Package javax.rules.admin

Examples of javax.rules.admin.RuleExecutionSet


    RuleAdministrator ruleAdministrator = serviceProvider
        .getRuleAdministrator();

    // register the ruleset
    InputStream inStream = this.getClass().getResourceAsStream(ruleset);
    RuleExecutionSet res1 = ruleAdministrator
        .getLocalRuleExecutionSetProvider(null).createRuleExecutionSet(
            inStream, null);

    inStream.close();
    String uri = res1.getName();
    System.out.println(uri);
    ruleAdministrator.registerRuleExecutionSet(uri, res1, null);
    return serviceProvider;
  }
View Full Code Here


    public void testCreateFromInputStream( ) throws Exception
    {
        InputStream rulesStream =
            RuleEngineTestBase.class.getResourceAsStream( bindUri );
        RuleExecutionSet ruleSet =
            ruleSetProvider.createRuleExecutionSet( rulesStream, null );
        assertEquals( "rule set name", "Sisters Rules", ruleSet.getName( ) );
        assertEquals( "number of rules", 1, ruleSet.getRules( ).size( ) );
    }
View Full Code Here

        log( "Got RuleAdministrator implementation: " + ruleAdministrator );
        // get an input stream to the file to load
        InputStream inStream = Main.class.getResourceAsStream( fileName );
        log( "Acquired InputStream to input file: " + inStream );
        // load a RuleExecutionSet
        RuleExecutionSet ruleExecutionSet =
            ruleAdministrator.getLocalRuleExecutionSetProvider( null )
                .createRuleExecutionSet( inStream, null );
        log( "Loaded RuleExecutionSet: " + ruleExecutionSet );
        // print the metadata about the ruleset
        log( "Name: " + ruleExecutionSet.getName( ) );
        log( "Description: " + ruleExecutionSet.getDescription( ) );
        log( "Rules:" );
        // print the names of the rules in the ruleset
        for ( Iterator it = ruleExecutionSet.getRules( ).iterator( );
              it.hasNext( ); )
        {
            Rule rule = ( Rule ) it.next( );
            log( rule.getName( ) );
        }
View Full Code Here

        String theBindUri = null;
        for ( Iterator i = repository.getRegistrations( ).iterator( );
              i.hasNext( ); )
        {
            String aBindUri = ( String ) i.next( );
            RuleExecutionSet aRuleSet =
                repository.getRuleExecutionSet( aBindUri );
            if ( aRuleSet == this.ruleExecutionSet )
            {
                theBindUri = aBindUri;
                break;
View Full Code Here

        {
            inputStream =
                RuleEngineTestBase.class.getResourceAsStream( bindUri );
            Reader in = new InputStreamReader( inputStream );
            RuleSet ruleSet = new RuleSetReader( ).read( in );
            RuleExecutionSet ruleExecutionSet =
                ruleSetProvider.createRuleExecutionSet( ruleSet, null );
            assertEquals( "rule set name", "Sisters Rules",
                          ruleExecutionSet.getName( ) );
            assertEquals(
                "number of rules", 1, ruleExecutionSet.getRules( ).size( ) );
        }
        catch ( IOException e )
        {
            fail( "Couldn't create the RuleExecutionSet. " +
                  "Test threw an IOException." );
View Full Code Here

     */
    public void testCreateFromReader() throws Exception
    {
        Reader ruleReader = new InputStreamReader(
            RuleEngineTestBase.class.getResourceAsStream( bindUri ) );
        RuleExecutionSet ruleSet =
            ruleSetProvider.createRuleExecutionSet( ruleReader, null );
        assertEquals( "rule set name", "Sisters Rules", ruleSet.getName( ) );
        assertEquals( "number of rules", 1, ruleSet.getRules( ).size( ) );
    }
View Full Code Here

    public void addRuleExecutionSet(
        String bindUri, InputStream resourceAsStream ) throws Exception
    {
        Reader ruleReader = new InputStreamReader( resourceAsStream );

        RuleExecutionSet ruleExecutionSet =
            ruleSetProvider.createRuleExecutionSet( ruleReader, null );

        ruleAdministrator.registerRuleExecutionSet(
            bindUri, ruleExecutionSet, null );
    }
View Full Code Here

        ruleAdministrator = ruleServiceProvider.getRuleAdministrator();

        // load the rules and register them
        LocalRuleExecutionSetProvider ruleSetProvider = ruleAdministrator.getLocalRuleExecutionSetProvider( null );
        InputStream rules = DroolsBenchmarkTestCase.class.getResourceAsStream( RULE_URI );
        RuleExecutionSet ruleExecutionSet = ruleSetProvider.createRuleExecutionSet( rules,
                                                                                    null );
        ruleAdministrator.registerRuleExecutionSet( RULE_URI,
                                                    ruleExecutionSet,
                                                    null );
View Full Code Here

  /* (non-Javadoc)
   * @see org.springmodules.jsr94.support.AbstractRuleSource#registerRuleExecutionSets()
   */
  protected void registerRuleExecutionSets() throws RuleExecutionSetCreateException, RemoteException, IOException, RuleExecutionSetRegisterException {
    RuleExecutionSet ruleExecutionSet = ruleAdministrator.getLocalRuleExecutionSetProvider(providerProperties).createRuleExecutionSet(source.getInputStream(), rulesetProperties);
    if (bindUri == null) {
      logger.info("Using RuleExecutionSet().getName() as bindUri");
      bindUri = ruleExecutionSet.getName();
    }
    ruleAdministrator.registerRuleExecutionSet(bindUri, ruleExecutionSet, registrationProperties);
  }
View Full Code Here

        }
       
        for ( final Iterator i = registrations.iterator(); i.hasNext(); ) {
            final String aBindUri = (String) i.next();
            // FIXME: provide the correct properties
            RuleExecutionSet aRuleSet = null;
           
            try {
                aRuleSet = this.repository.getRuleExecutionSet( aBindUri, null );
            } catch (RuleExecutionSetRepositoryException e) {
                String s = "Error while retrieving rule execution set bound to: " + aBindUri;
View Full Code Here

TOP

Related Classes of javax.rules.admin.RuleExecutionSet

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.