[jboss-svn-commits] JBL Code SVN: r33966 - in labs/jbossrules/trunk: drools-core/src/main/java/org/drools/definitions/rule/impl and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jul 16 20:31:54 EDT 2010
Author: tirelli
Date: 2010-07-16 20:31:54 -0400 (Fri, 16 Jul 2010)
New Revision: 33966
Modified:
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/definition/rule/Rule.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/definitions/rule/impl/RuleImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/impl/SerializedRule.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Rule.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/rule/impl/SerializedRule.java
Log:
Fixing metadata interface to make mark happy. :)
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/definition/rule/Rule.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/definition/rule/Rule.java 2010-07-17 00:11:56 UTC (rev 33965)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/definition/rule/Rule.java 2010-07-17 00:31:54 UTC (rev 33966)
@@ -27,6 +27,14 @@
String getName();
/**
+ * Returns an immutable Map<String key, Object value> of all meta data attributes associated with
+ * this rule object.
+ *
+ * @return an immutable Map<String key, Object value> of meta data attributes.
+ */
+ Map<String, Object> getMetaData();
+
+ /**
* This method is deprecated. Please use {@link Rule#getMetaAttributes()} instead.
*
* @return a collection with all the meta attribute keys associated with this Rule.
@@ -39,8 +47,10 @@
* Returns an immutable Map<String key, String value> of all meta attributes associated with this rule object.
*
* @return an immutable Map<String key, String value> of meta attributes.
+ * @deprecated
*/
- Map<String, String> getMetaAttributes();
+ @Deprecated
+ Map<String, Object> getMetaAttributes();
/**
* Returns the value of the meta attribute identified by the "key"
@@ -48,6 +58,8 @@
* @param key the meta attribute key
*
* @return the meta attribute value or null if there is no value for that key.
+ * @deprecated
*/
+ @Deprecated
String getMetaAttribute(final String key);
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/definitions/rule/impl/RuleImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/definitions/rule/impl/RuleImpl.java 2010-07-17 00:11:56 UTC (rev 33965)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/definitions/rule/impl/RuleImpl.java 2010-07-17 00:31:54 UTC (rev 33966)
@@ -20,6 +20,7 @@
return this.rule.getPackage();
}
+ @Deprecated
public String getMetaAttribute(String identifier) {
return this.rule.getMetaAttribute( identifier );
}
@@ -29,9 +30,14 @@
return this.rule.getMetaAttributes().keySet();
}
- public Map<String, String> getMetaAttributes() {
+ @Deprecated
+ public Map<String, Object> getMetaAttributes() {
return this.rule.getMetaAttributes();
}
+
+ public Map<String, Object> getMetaData() {
+ return this.rule.getMetaData();
+ }
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/impl/SerializedRule.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/impl/SerializedRule.java 2010-07-17 00:11:56 UTC (rev 33965)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/impl/SerializedRule.java 2010-07-17 00:31:54 UTC (rev 33966)
@@ -17,7 +17,7 @@
Externalizable {
private String name;
private String packageName;
- private Map<String, String> metaAttributes;
+ private Map<String, Object> metaAttributes;
public SerializedRule() {
@@ -26,11 +26,7 @@
public SerializedRule(Rule rule) {
this.name = rule.getName();
this.packageName = rule.getPackageName();
- Collection<String> identifiers = rule.listMetaAttributes();
- this.metaAttributes = new HashMap<String, String>(identifiers.size());
- for ( String identifier : identifiers ) {
- this.metaAttributes.put( identifier, rule.getMetaAttribute( identifier ) );
- }
+ this.metaAttributes = new HashMap<String, Object>( rule.getMetaData() );
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -43,7 +39,7 @@
ClassNotFoundException {
name = in.readUTF();
packageName = in.readUTF();
- this.metaAttributes = ( Map<String, String> ) in.readObject();
+ this.metaAttributes = ( Map<String, Object> ) in.readObject();
}
public String getName() {
@@ -54,8 +50,9 @@
return this.packageName;
}
+ @Deprecated
public String getMetaAttribute(String identifier) {
- return this.metaAttributes.get( identifier );
+ return this.metaAttributes.get( identifier ).toString();
}
@Deprecated
@@ -63,8 +60,13 @@
return this.metaAttributes.keySet();
}
- public Map<String, String> getMetaAttributes() {
+ @Deprecated
+ public Map<String, Object> getMetaAttributes() {
return Collections.unmodifiableMap( this.metaAttributes );
}
+ public Map<String, Object> getMetaData() {
+ return Collections.unmodifiableMap( this.metaAttributes );
+ }
+
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Rule.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Rule.java 2010-07-17 00:11:56 UTC (rev 33965)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Rule.java 2010-07-17 00:31:54 UTC (rev 33966)
@@ -90,7 +90,7 @@
private String agendaGroup;
- private Map<String, String> metaAttributes;
+ private Map<String, Object> metaAttributes;
/** Consequence. */
private Consequence consequence;
@@ -179,7 +179,7 @@
lhsRoot = (GroupElement) in.readObject();
dialect = (String) in.readObject();
agendaGroup = (String) in.readObject();
- metaAttributes = (Map<String, String>) in.readObject();
+ metaAttributes = (Map<String, Object>) in.readObject();
consequence = (Consequence) in.readObject();
namedConsequence = (Map<String, Consequence>) in.readObject();
@@ -222,7 +222,7 @@
this.semanticallyValid = true;
this.enabled = EnabledBoolean.ENABLED_TRUE;
this.salience = SalienceInteger.DEFAULT_SALIENCE;
- this.metaAttributes = new HashMap<String, String>();
+ this.metaAttributes = new HashMap<String, Object>();
}
@@ -709,22 +709,24 @@
workingMemory );
}
- public void setMetaAttributes(Map<String, String> metaAttributes) {
- this.metaAttributes = metaAttributes;
- }
-
public void addMetaAttribute(String key,
- String value) {
+ Object value) {
this.metaAttributes.put( key,
value );
}
- public Map<String, String> getMetaAttributes() {
+ public Map<String, Object> getMetaData() {
return Collections.unmodifiableMap( metaAttributes );
}
+ @Deprecated
+ public Map<String, Object> getMetaAttributes() {
+ return Collections.unmodifiableMap( metaAttributes );
+ }
+
+ @Deprecated
public String getMetaAttribute(final String identifier) {
- return (String) this.metaAttributes.get( identifier );
+ return this.metaAttributes.get( identifier ).toString();
}
@Deprecated
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/rule/impl/SerializedRule.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/rule/impl/SerializedRule.java 2010-07-17 00:11:56 UTC (rev 33965)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/rule/impl/SerializedRule.java 2010-07-17 00:31:54 UTC (rev 33966)
@@ -17,7 +17,7 @@
Externalizable {
private String name;
private String packageName;
- private Map<String, String> metaAttributes;
+ private Map<String, Object> metaAttributes;
public SerializedRule() {
@@ -26,7 +26,7 @@
public SerializedRule(Rule rule) {
this.name = rule.getName();
this.packageName = rule.getPackageName();
- this.metaAttributes = new HashMap<String, String>( rule.getMetaAttributes() );
+ this.metaAttributes = new HashMap<String, Object>( rule.getMetaData() );
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -40,7 +40,7 @@
ClassNotFoundException {
name = in.readUTF();
packageName = in.readUTF();
- this.metaAttributes = ( Map<String, String> ) in.readObject();
+ this.metaAttributes = ( Map<String, Object> ) in.readObject();
}
public String getName() {
@@ -51,15 +51,23 @@
return this.packageName;
}
+ @Deprecated
public String getMetaAttribute(String identifier) {
- return this.metaAttributes.get( identifier );
+ return this.metaAttributes.get( identifier ).toString();
}
+ @Deprecated
public Collection<String> listMetaAttributes() {
return this.metaAttributes.keySet();
}
- public Map<String, String> getMetaAttributes() {
+ @Deprecated
+ public Map<String, Object> getMetaAttributes() {
return Collections.unmodifiableMap( this.metaAttributes );
}
+
+ public Map<String, Object> getMetaData() {
+ return Collections.unmodifiableMap( this.metaAttributes );
+ }
+
}
More information about the jboss-svn-commits
mailing list