Source Code Cross Referenced for AbstractRuleSessionImpl.java in  » Rule-Engine » drolls-Rule-Engine » org » drools » jsr94 » rules » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Rule Engine » drolls Rule Engine » org.drools.jsr94.rules 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.drools.jsr94.rules;
002:
003:        /*
004:         * Copyright 2005 JBoss Inc
005:         * 
006:         * Licensed under the Apache License, Version 2.0 (the "License");
007:         * you may not use this file except in compliance with the License.
008:         * You may obtain a copy of the License at
009:         * 
010:         *      http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS,
014:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         * See the License for the specific language governing permissions and
016:         * limitations under the License.
017:         */
018:
019:        import java.util.Iterator;
020:        import java.util.Map;
021:
022:        import javax.rules.InvalidRuleSessionException;
023:        import javax.rules.RuleExecutionSetMetadata;
024:        import javax.rules.RuleSession;
025:        import javax.rules.admin.RuleExecutionSet;
026:
027:        import org.drools.jsr94.rules.admin.RuleExecutionSetImpl;
028:        import org.drools.jsr94.rules.admin.RuleExecutionSetRepository;
029:
030:        /**
031:         * The Drools implementation of the <code>RuleSession</code> interface which is
032:         * a representation of a client session with a rules engine. A rules engine
033:         * session serves as an entry point into an underlying rules engine. The
034:         * <code>RuleSession</code> is bound to a rules engine instance and exposes a
035:         * vendor-neutral rule processing API for executing <code>Rule</code>s within a
036:         * bound <code>RuleExecutionSet</code>.
037:         * <p/>
038:         * Note: the <code>release</code> method must be called to clean up all
039:         * resources used by the <code>RuleSession</code>. Calling <code>release</code>
040:         * may make the <code>RuleSession</code> eligible to be returned to a
041:         * <code>RuleSession</code> pool.
042:         *
043:         * @see RuleSession
044:         *
045:         * @author N. Alex Rupp (n_alex <at>codehaus.org)
046:         * @author <a href="mailto:thomas.diesler@softcon-itec.de">thomas diesler </a>
047:         */
048:        abstract class AbstractRuleSessionImpl implements  RuleSession {
049:            private RuleExecutionSetRepository repository;
050:
051:            public AbstractRuleSessionImpl(
052:                    final RuleExecutionSetRepository repository) {
053:                this .repository = repository;
054:            }
055:
056:            /**
057:             * The Drools <code>RuleExecutionSet</code> associated
058:             * with this <code>RuleSession</code>.
059:             */
060:            private RuleExecutionSetImpl ruleExecutionSet;
061:
062:            /**
063:             * A <code>Map</code> of <code>String</code>/<code>Object</code> pairs
064:             * passed as application data to the Drools <code>WorkingMemory</code>.
065:             */
066:            private Map properties;
067:
068:            /**
069:             * Sets additional properties used to create this <code>RuleSession</code>.
070:             *
071:             * @param properties additional properties used to create the
072:             *        <code>RuleSession</code> implementation.
073:             */
074:            protected void setProperties(final Map properties) {
075:                this .properties = properties;
076:            }
077:
078:            /**
079:             * Returns the additional properties used to create this
080:             * <code>RuleSession</code>.
081:             *
082:             * @return the additional properties used to create this
083:             *         <code>RuleSession</code>.
084:             */
085:            protected Map getProperties() {
086:                return this .properties;
087:            }
088:
089:            /**
090:             * Sets the Drools <code>RuleExecutionSet</code> associated
091:             * with this <code>RuleSession</code>.
092:             *
093:             * @param ruleExecutionSet the Drools <code>RuleExecutionSet</code> to associate
094:             *        with this <code>RuleSession</code>.
095:             */
096:            protected void setRuleExecutionSet(
097:                    final RuleExecutionSetImpl ruleExecutionSet) {
098:                this .ruleExecutionSet = ruleExecutionSet;
099:            }
100:
101:            /**
102:             * Returns the Drools <code>RuleExecutionSet</code> associated
103:             * with this <code>RuleSession</code>.
104:             *
105:             * @return the Drools <code>RuleExecutionSet</code> associated
106:             * with this <code>RuleSession</code>.
107:             */
108:            protected RuleExecutionSetImpl getRuleExecutionSet() {
109:                return this .ruleExecutionSet;
110:            }
111:
112:            protected abstract void checkRuleSessionValidity()
113:                    throws InvalidRuleSessionException;
114:
115:            // JSR94 interface methods start here -------------------------------------
116:
117:            /**
118:             * Returns the meta data for the rule execution set bound to this rule
119:             * session.
120:             *
121:             * @return the RuleExecutionSetMetaData bound to this rule session.
122:             */
123:            public RuleExecutionSetMetadata getRuleExecutionSetMetadata() {
124:                String theBindUri = null;
125:                for (final Iterator i = this .repository.getRegistrations()
126:                        .iterator(); i.hasNext();) {
127:                    final String aBindUri = (String) i.next();
128:                    final RuleExecutionSet aRuleSet = this .repository
129:                            .getRuleExecutionSet(aBindUri);
130:                    if (aRuleSet == this .ruleExecutionSet) {
131:                        theBindUri = aBindUri;
132:                        break;
133:                    }
134:                }
135:
136:                return new RuleExecutionSetMetadataImpl(theBindUri,
137:                        this .ruleExecutionSet.getName(), this .ruleExecutionSet
138:                                .getDescription());
139:            }
140:
141:            /**
142:             * Releases all resources used by this rule session.
143:             * This method renders this rule session unusable until
144:             * it is reacquired through the <code>RuleRuntime</code>.
145:             */
146:            public void release() {
147:                setProperties(null);
148:                setRuleExecutionSet(null);
149:            }
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.