Author: adietish
Date: 2011-02-03 08:06:52 -0500 (Thu, 03 Feb 2011)
New Revision: 28970
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllMatcher.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
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/IFieldMatcher.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceFilter.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
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/StringMatcher.java
Log:
[JBIDE-8187][JBIDE-8320]
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -44,6 +44,9 @@
}
protected Iterator<String> setRules(String rules) {
+ if (rules == null) {
+ return emptyRulesIterator();
+ }
Iterator<String> rulesIterator =
Arrays.asList(rules.split(EXPRESSION_DELIMITER)).iterator();
setRules(createRule(rulesIterator), createRule(rulesIterator));
return rulesIterator;
@@ -94,8 +97,8 @@
@Override
public String toString() {
- return nameRule + ";" //$NON-NLS-1$
- + idRule + ";"; //$NON-NLS-1$
+ return nameRule + EXPRESSION_DELIMITER
+ + idRule + EXPRESSION_DELIMITER;
}
@Override
@@ -107,4 +110,14 @@
public IFieldMatcher getIdRule() {
return idRule;
}
+
+ protected Iterator<String> emptyRulesIterator() {
+ return new ArrayList<String>().iterator();
+ }
+
+ public boolean isFiltering() {
+ return idRule.isMatchesAll()
+ && nameRule.isMatchesAll();
+ }
+
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllMatcher.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllMatcher.java 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllMatcher.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -1,5 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.deltacloud.core;
+/**
+ * @author Jeff Johnston
+ * @author André Dietisheim
+ */
public class AllMatcher implements IFieldMatcher {
@Override
@@ -9,7 +23,10 @@
@Override
public String toString() {
- return "*"; //$NON-NLS-1$
+ return ICloudElementFilter.ALL_MATCHER_EXPRESSION;
}
+ public boolean isMatchesAll() {
+ return true;
+ }
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -69,8 +69,7 @@
public DeltaCloud(String name, String url, String username, String password,
DeltaCloudDriver driver)
throws DeltaCloudException {
- this(name, url, username, password, driver, IImageFilter.ALL_STRING,
IInstanceFilter.ALL_STRING,
- new ArrayList<IInstanceAliasMapping>());
+ this(name, url, username, password, driver, null, null, new
ArrayList<IInstanceAliasMapping>());
}
public DeltaCloud(String name, String url, String username, DeltaCloudDriver driver,
String imageFilterRules,
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -105,7 +105,7 @@
DeltaCloudXMLBuilder.ENCODING); // $NON-NLS-1$
DeltaCloudDriver driver =
DeltaCloudDriver.checkedValueOf(attrs.getNamedItem(DeltaCloudXMLBuilder.ATTR_TYPE).getNodeValue());
// $NON-NLS-1$
String imageFilterRules =
getImageFilterRules(attrs.getNamedItem("imagefilter")); // $NON-NLS-1$
- String instanceFilterRules =
getInstanceFilterRules(attrs.getNamedItem("instancefilter")); // $NON-NLS-1$
+ String instanceFilterRules =
getNodeValue(attrs.getNamedItem("instancefilter")); // $NON-NLS-1$
String lastKeyName =
getNodeValue(attrs.getNamedItem(DeltaCloudXMLBuilder.ATTR_LASTKEYNAME)); // $NON-NLS-1$
String lastImageId =
getNodeValue(attrs.getNamedItem(DeltaCloudXMLBuilder.ATTR_LASTIMAGE)); // $NON-NLS-1$
Collection<IInstanceAliasMapping> aliasMappings = getInstanceMappings(n);
@@ -162,16 +162,8 @@
return null;
}
- private String getInstanceFilterRules(Node instanceFilterNode) {
- String instanceFilterRules = IInstanceFilter.ALL_STRING;
- if (instanceFilterNode != null) {
- instanceFilterRules = instanceFilterNode.getNodeValue();
- }
- return instanceFilterRules;
- }
-
private String getImageFilterRules(Node imageFilterNode) {
- String imageFilterRules = IImageFilter.ALL_STRING;
+ String imageFilterRules = null;
if (imageFilterNode != null) {
imageFilterRules = imageFilterNode.getNodeValue();
}
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 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -29,13 +29,6 @@
public static final String ALL_MATCHER_EXPRESSION = "*"; //$NON-NLS-1$
- public static final String ALL_STRING =
- ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // alias
- + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // name
- + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // id
- + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // arch
- + ALL_MATCHER_EXPRESSION; // desc
-
public Collection<CLOUDELEMENT> filter(CLOUDELEMENT[] cloudElements) throws
DeltaCloudException;
public IFieldMatcher getNameRule();
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -16,5 +16,5 @@
public interface IFieldMatcher {
public boolean matches(String input);
-
+ public boolean isMatchesAll();
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceFilter.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceFilter.java 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceFilter.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -22,4 +22,5 @@
public IFieldMatcher getKeyNameRule();
public IFieldMatcher getRealmRule();
public IFieldMatcher getProfileRule();
+ public boolean isFiltering();
}
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 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -77,4 +77,10 @@
public IFieldMatcher getDescRule() {
return descRule;
}
+
+ public boolean isFiltering() {
+ return super.isFiltering()
+ && archRule.isMatchesAll()
+ && descRule.isMatchesAll();
+ }
}
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 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/InstanceFilter.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -127,4 +127,14 @@
public IFieldMatcher getRealmRule() {
return realmRule;
}
+
+ public boolean isFiltering() {
+ return super.isFiltering()
+ && aliasRule.isMatchesAll()
+ && imageIdRule.isMatchesAll()
+ && keyNameRule.isMatchesAll()
+ && ownerIdRule.isMatchesAll()
+ && profileRule.isMatchesAll()
+ && realmRule.isMatchesAll();
+ }
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/StringMatcher.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/StringMatcher.java 2011-02-03
13:06:43 UTC (rev 28969)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/StringMatcher.java 2011-02-03
13:06:52 UTC (rev 28970)
@@ -59,4 +59,7 @@
return rule;
}
+ public boolean isMatchesAll() {
+ return false;
+ }
}