Author: adietish
Date: 2010-11-09 08:49:25 -0500 (Tue, 09 Nov 2010)
New Revision: 26369
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/InstanceFilter.java
Log:
[JBIDE-7518] removed duplicate code for matcher creation
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-11-09 13:44:59
UTC (rev 26368)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-11-09 13:49:25
UTC (rev 26369)
@@ -1,6 +1,19 @@
2010-11-09 André Dietisheim <adietish(a)redhat.com>
- * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (editCloud): [JBIDE-7521] storing
cloud after it has been edited
+ * src/org/jboss/tools/deltacloud/core/ImageFilter.java (setRules):
+ * src/org/jboss/tools/deltacloud/core/InstanceFilter.java
+ (setRules):
+ (createRule):
+ [JBIDE-7518] removed duplicate code for matcher creation
+ (createRule):
+ (setRules):
+ [JBIDE-7518] removed duplicate code for matcher creation
+ * src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java:
+ * src/org/jboss/tools/deltacloud/core/IImageFilter.java:
+ * src/org/jboss/tools/deltacloud/core/IInstanceFilter.java
+
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (editCloud):
+ [JBIDE-7521] storing cloud after it has been edited
(editCloud):
[JBIDE-7518] added notification after cloud was edited
(DeltaCloud):
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java 2010-11-09
13:44:59 UTC (rev 26368)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java 2010-11-09
13:49:25 UTC (rev 26369)
@@ -12,15 +12,15 @@
public interface ICloudElementFilter {
- public static final String RULE_DELIMITER = ";"; // $NON-NLS-1$
+ public static final String EXPRESSION_DELIMITER = ";"; // $NON-NLS-1$
- public static final String ALL_MATCHER = "*"; //$NON-NLS-1$
+ public static final String ALL_MATCHER_EXPRESSION = "*"; //$NON-NLS-1$
public static final String ALL_STRING =
- ALL_MATCHER + RULE_DELIMITER // name
- + ALL_MATCHER + RULE_DELIMITER // id
- + ALL_MATCHER + RULE_DELIMITER // arch
- + ALL_MATCHER; // desc
+ ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // name
+ + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // id
+ + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // arch
+ + ALL_MATCHER_EXPRESSION; // desc
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java 2010-11-09
13:44:59 UTC (rev 26368)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java 2010-11-09
13:49:25 UTC (rev 26369)
@@ -38,7 +38,7 @@
}
private IFieldMatcher createRule(String token) {
- if (token.equals(ALL_MATCHER)) { //$NON-NLS-1$
+ if (token.equals(ALL_MATCHER_EXPRESSION)) { //$NON-NLS-1$
return new AllFieldMatcher();
} else {
return new FieldMatcher(token);
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/InstanceFilter.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/InstanceFilter.java 2010-11-09
13:44:59 UTC (rev 26368)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/InstanceFilter.java 2010-11-09
13:49:25 UTC (rev 26369)
@@ -26,41 +26,21 @@
@Override
public void setRules(String ruleString) throws PatternSyntaxException {
String[] tokens = ruleString.split(";");
- if (tokens[0].equals("*")) { //$NON-NLS-1$
- nameRule = new AllFieldMatcher();
+ this.nameRule = createRule(tokens[0]);
+ this.idRule = createRule(tokens[1]);
+ this.imageIdRule = createRule(tokens[2]);
+ this.ownerIdRule = createRule(tokens[3]);
+ this.keyNameRule = createRule(tokens[4]);
+ this.realmRule = createRule(tokens[5]);
+ this.profileRule = createRule(tokens[6]);
+ }
+
+ private IFieldMatcher createRule(String expression) {
+ if (expression.equals(ALL_MATCHER_EXPRESSION)) { //$NON-NLS-1$
+ return new AllFieldMatcher();
} else {
- nameRule = new FieldMatcher(tokens[0]);
+ return new FieldMatcher(expression);
}
- if (tokens[1].equals("*")) { //$NON-NLS-1$
- idRule = new AllFieldMatcher();
- } else {
- idRule = new FieldMatcher(tokens[1]);
- }
- if (tokens[2].equals("*")) { //$NON-NLS-1$
- imageIdRule = new AllFieldMatcher();
- } else {
- imageIdRule = new FieldMatcher(tokens[2]);
- }
- if (tokens[3].equals("*")) { //$NON-NLS-1$
- ownerIdRule = new AllFieldMatcher();
- } else {
- ownerIdRule = new FieldMatcher(tokens[3]);
- }
- if (tokens[4].equals("*")) { //$NON-NLS-1$
- keyNameRule = new AllFieldMatcher();
- } else {
- keyNameRule = new FieldMatcher(tokens[4]);
- }
- if (tokens[5].equals("*")) { //$NON-NLS-1$
- realmRule = new AllFieldMatcher();
- } else {
- realmRule = new FieldMatcher(tokens[5]);
- }
- if (tokens[6].equals("*")) { //$NON-NLS-1$
- profileRule = new AllFieldMatcher();
- } else {
- profileRule = new FieldMatcher(tokens[6]);
- }
}
@Override
Show replies by date