Author: mriou
Date: Wed Sep 13 09:04:45 2006
New Revision: 443007
URL: http://svn.apache.org/viewvc?view=rev&rev=443007
Log:
Fixed a bug on instance detail querying. Added a testcase for it.
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
incubator/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/InstanceFilter.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?view=diff&rev=443007&r1=443006&r2=443007
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
(original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
Wed Sep 13 09:04:45 2006
@@ -128,11 +128,12 @@
__log.debug("Initializing JCA adapter.");
initConnector();
+ File deploymentDir = new File(_appRoot, "processes");
+ _poller = new DeploymentPoller(deploymentDir, this);
+
new ManagementService().enableService(_axisConfig, _server,
_appRoot.getAbsolutePath());
new DeploymentWebService().enableService(_axisConfig, _server,
_poller, _appRoot.getAbsolutePath());
- File deploymentDir = new File(_appRoot, "processes");
- _poller = new DeploymentPoller(deploymentDir, this);
_poller.start();
__log.info(__msgs.msgPollingStarted(deploymentDir.getAbsolutePath()));
Modified:
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java?view=diff&rev=443007&r1=443006&r2=443007
==============================================================================
---
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
(original)
+++
incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
Wed Sep 13 09:04:45 2006
@@ -173,7 +173,7 @@
sendResponse(factory, messageContext,
"getProcessPackageResponse", response);
} else unknown = true;
} catch (Throwable t) {
- throw new AxisFault("Invokcation of operation " + operation +
" failed!", t);
+ throw new AxisFault("Invocation of operation " + operation + "
failed!", t);
}
if (unknown) throw new AxisFault("Unknown operation: '"
+ messageContext.getAxisOperation().getName() + "'");
Modified:
incubator/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java?view=diff&rev=443007&r1=443006&r2=443007
==============================================================================
---
incubator/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
(original)
+++
incubator/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
Wed Sep 13 09:04:45 2006
@@ -38,6 +38,7 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
+import java.util.Iterator;
public class InstanceManagementTest extends TestCase {
@@ -73,6 +74,22 @@
result.toString().indexOf("DynPartnerResponder") >= 0);
}
+ public void testInstanceSummaryListProcess() throws Exception {
+ OMElement listRoot = _client.buildMessage("listProcesses", new
String[] {"filter", "orderKeys"},
+ new String[] {"name=DynPartnerMain", ""});
+ OMElement result = sendToPM(listRoot);
+ // Ensures that there's only 2 process-info string (ending and closing
tags) and hence only one process
+ String ns = "http://www.apache.org/ode/pmapi/types/2006/08/02/";
+ Iterator iter = result.getFirstElement().getFirstChildWithName(new
QName(ns, "instance-summary"))
+ .getChildrenWithName(new QName(ns, "instances"));
+ int count = 0;
+ while (iter.hasNext()) {
+ OMElement omelmt = (OMElement) iter.next();
+ count += Integer.parseInt(omelmt.getAttributeValue(new QName(null,
"count")));
+ }
+ assert(count == 1);
+ }
+
public void testGetInstanceInfo() throws Exception {
OMElement root = _client.buildMessage("listAllInstances", new String[]
{}, new String[] {});
OMElement result = sendToIM(root);
@@ -164,7 +181,7 @@
// Execute
URL svcUrl = new
URL("http://localhost:8080/ode/processes/DynMainService");
InputStream sis =
getClass().getClassLoader().getResourceAsStream("testDynPartnerRequest.soap");
- HttpSoapSender.doSend(svcUrl, sis, System.out);
+ HttpSoapSender.doSend(svcUrl, sis, System.out, null, 0, null, null,
null);
// Just making sure the instance starts
Thread.sleep(1000);
}
Modified:
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/InstanceFilter.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/InstanceFilter.java?view=diff&rev=443007&r1=443006&r2=443007
==============================================================================
---
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/InstanceFilter.java
(original)
+++
incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/common/InstanceFilter.java
Wed Sep 13 09:04:45 2006
@@ -23,7 +23,11 @@
import java.io.Serializable;
import java.text.ParseException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
/**
* Holds a filter that will get interpreted when listing processe instances.
The
@@ -31,309 +35,308 @@
* ProcessQuery class. Here we're introducing a pseudo process querying
* language.
*/
-public class InstanceFilter extends Filter<InstanceFilter.Criteria> implements
- Serializable {
+public class InstanceFilter extends Filter<InstanceFilter.Criteria> implements
Serializable {
- private static final long serialVersionUID = 9999;
+ private static final long serialVersionUID = 9999;
- /** If set, will filter on the instance id (IID) */
- private String iid;
+ /** If set, will filter on the instance id (IID) */
+ private String iid;
- /** If set, will filter on the process id (PID) */
- private String pid;
-
- /** If set, will filter on the process name (accepts ending with wildcard) */
- private String nameFilter;
-
- /** If set, will filter on the process name (accepts ending with wildcard) */
- private String namespaceFilter;
-
- /**
- * If set, will filter on the instance status. Status being exclusive,
- * statuses are joined with an 'or'.
- */
- private List<String> statusFilter;
-
- /**
- * If set, will filter on the process started date. Prefixed with a
comparison
- * operator (<, >, <=, >=, =). We're keeping a string and note converting to
- * a java date as ISO string dates are much easier and quicker to manipulate.
- * It's possible to have more than one date filter to handle the 'between'
- * case.
- */
- private List<String> startedDateFilter;
-
- /** If set, will filter on the process last active date. */
- private List<String> lastActiveDateFilter;
-
- private Map<String, String> propertyValuesFilter;
-
- /**
- * Orders to use when sorting the result (no particular order if not set).
- * Currently /supported keys are:
- * <ul>
- * <li>pid</li>
- * <li>name</li>
- * <li>namespace</li>
- * <li>version</li>
- * <li>status</li>
- * <li>started</li>
- * <li>last-active</li>
- * </ul>
- * Each key can be prefixed with a + or - sign for ascending or descending
- * orders (ascending if no sign specified)..
- */
- public List<String> orders;
-
- private int limit;
-
- /**
- * Known criteria (and a means to process them).
- */
- enum Criteria {
- IID {
- void process(InstanceFilter filter, String key, String op, String value)
{
- filter.iid = value;
- }
- },
- PID {
- void process(InstanceFilter filter, String key, String op, String value)
{
- filter.pid = value;
- }
- },
- NAME {
- void process(InstanceFilter filter, String key, String op, String value)
{
- filter.nameFilter = value;
- }
- },
- NAMESPACE {
- void process(InstanceFilter filter, String key, String op, String value)
{
- filter.namespaceFilter = value;
- }
- },
- STATUS {
- void process(InstanceFilter filter, String key, String op, String value)
{
- if (filter.statusFilter == null)
- filter.statusFilter = new ArrayList<String>(5);
- // Status can have '|' to assemble several status with or
- for (StringTokenizer statusTok = new StringTokenizer(value, "|");
statusTok
- .hasMoreTokens();) {
- String status = statusTok.nextToken();
- filter.statusFilter.add(status);
+ /** If set, will filter on the process id (PID) */
+ private String pid;
+
+ /** If set, will filter on the process name (accepts ending with wildcard)
*/
+ private String nameFilter;
+
+ /** If set, will filter on the process name (accepts ending with wildcard)
*/
+ private String namespaceFilter;
+
+ /**
+ * If set, will filter on the instance status. Status being exclusive,
+ * statuses are joined with an 'or'.
+ */
+ private List<String> statusFilter;
+
+ /**
+ * If set, will filter on the process started date. Prefixed with a
comparison
+ * operator (<, >, <=, >=, =). We're keeping a string and note converting
to
+ * a java date as ISO string dates are much easier and quicker to
manipulate.
+ * It's possible to have more than one date filter to handle the 'between'
+ * case.
+ */
+ private List<String> startedDateFilter;
+
+ /** If set, will filter on the process last active date. */
+ private List<String> lastActiveDateFilter;
+
+ private Map<String, String> propertyValuesFilter;
+
+ /**
+ * Orders to use when sorting the result (no particular order if not set).
+ * Currently /supported keys are:
+ * <ul>
+ * <li>pid</li>
+ * <li>name</li>
+ * <li>namespace</li>
+ * <li>version</li>
+ * <li>status</li>
+ * <li>started</li>
+ * <li>last-active</li>
+ * </ul>
+ * Each key can be prefixed with a + or - sign for ascending or descending
+ * orders (ascending if no sign specified)..
+ */
+ public List<String> orders;
+
+ private int limit;
+
+ /**
+ * Known criteria (and a means to process them).
+ */
+ enum Criteria {
+ IID {
+ void process(InstanceFilter filter, String key, String op, String
value) {
+ filter.iid = value;
+ }
+ },
+ PID {
+ void process(InstanceFilter filter, String key, String op, String
value) {
+ filter.pid = value;
+ }
+ },
+ NAME {
+ void process(InstanceFilter filter, String key, String op, String
value) {
+ filter.nameFilter = value;
+ }
+ },
+ NAMESPACE {
+ void process(InstanceFilter filter, String key, String op, String
value) {
+ filter.namespaceFilter = value;
+ }
+ },
+ STATUS {
+ void process(InstanceFilter filter, String key, String op, String
value) {
+ if (filter.statusFilter == null)
+ filter.statusFilter = new ArrayList<String>(5);
+ // Status can have '|' to assemble several status with or
+ for (StringTokenizer statusTok = new StringTokenizer(value,
"|"); statusTok
+ .hasMoreTokens();) {
+ String status = statusTok.nextToken();
+ filter.statusFilter.add(status);
+ }
+ }
+ },
+ STARTED {
+ void process(InstanceFilter filter, String key, String op, String
value) {
+ if (filter.startedDateFilter == null)
+ filter.startedDateFilter = new ArrayList<String>();
+ filter.startedDateFilter.add(op + value);
+ }
+ },
+ LAST_ACTIVE {
+ void process(InstanceFilter filter, String key, String op, String
value) {
+ if (filter.lastActiveDateFilter == null)
+ filter.lastActiveDateFilter = new ArrayList<String>();
+ filter.lastActiveDateFilter.add(op + value);
+ }
+ },
+ PROPERTY {
+ void process(InstanceFilter filter, String key, String op, String
value) {
+ if (filter.propertyValuesFilter == null)
+ filter.propertyValuesFilter = new HashMap<String,
String>(5);
+ filter.propertyValuesFilter.put(key.substring(1,
key.length()), value);
+ }
+ };
+
+ abstract void process(InstanceFilter filter, String key, String op,
String value);
+ }
+
+ enum OrderKeys {
+ PID, NAME, NAMESPACE, VERSION, STATUS, STARTED, LAST_ACTIVE;
+ }
+
+ public enum StatusKeys {
+ ACTIVE, SUSPENDED, ERROR, COMPLETED, TERMINATED, FAILED;
+ }
+
+ /**
+ * Initializes properly the InstanceFilter attributes by pre-parsing the
+ * filter and orderKeys strings and setting the limit. A limit inferior
than
+ * or equal to 0 is ignored.
+ *
+ * @param filter
+ * @param orderKeys
+ */
+ public InstanceFilter(String filter, String orderKeys, int limit) {
+ init(filter);
+
+ // Some additional validation on status values
+ if (statusFilter != null) {
+ for (String status : statusFilter) {
+ try {
+ StatusKeys.valueOf(status.toUpperCase());
+ } catch (IllegalArgumentException e) {
+ throw new InvalidRequestException(
+ "The status you're using in your filter isn't
valid, "
+ + "only the active, suspended, error,
completed, terminated and faulted status are "
+ + "valid. " + e.toString());
+ }
+ }
}
- }
- },
- STARTED {
- void process(InstanceFilter filter, String key, String op, String value)
{
- if (filter.startedDateFilter == null)
- filter.startedDateFilter = new ArrayList<String>();
- filter.startedDateFilter.add(op + value);
- }
- },
- LAST_ACTIVE {
- void process(InstanceFilter filter, String key, String op, String value)
{
- if (filter.lastActiveDateFilter == null)
- filter.lastActiveDateFilter = new ArrayList<String>();
- filter.lastActiveDateFilter.add(op + value);
- }
- },
- PROPERTY {
- void process(InstanceFilter filter, String key, String op, String value)
{
- if (filter.propertyValuesFilter == null)
- filter.propertyValuesFilter = new HashMap<String, String>(5);
- filter.propertyValuesFilter.put(key.substring(1, key.length()), value);
- }
- };
-
- abstract void process(InstanceFilter filter, String key, String op, String
value);
- }
-
- enum OrderKeys {
- PID, NAME, NAMESPACE, VERSION, STATUS, STARTED, LAST_ACTIVE;
- }
-
- enum StatusKeys {
- ACTIVE, SUSPENDED, ERROR, COMPLETED, TERMINATED, FAILED;
- }
-
- /**
- * Initializes properly the InstanceFilter attributes by pre-parsing the
- * filter and orderKeys strings and setting the limit. A limit inferior than
- * or equal to 0 is ignored.
- *
- * @param filter
- * @param orderKeys
- */
- public InstanceFilter(String filter, String orderKeys, int limit) {
- init(filter);
-
- // Some additional validation on status values
- if (statusFilter != null) {
- for (String status : statusFilter) {
- try {
- StatusKeys.valueOf(status.toUpperCase());
- } catch (IllegalArgumentException e) {
- throw new InvalidRequestException(
- "The status you're using in your filter isn't valid, "
- + "only the active, suspended, error, completed, terminated
and faulted status are "
- + "valid. " + e.toString());
+ // Some additional validation on date format value
+ if (startedDateFilter != null) {
+ for (String ddf : startedDateFilter) {
+ try {
+ ISO8601DateParser.parse(getDateWithoutOp(ddf));
+ } catch (ParseException e) {
+ throw new InvalidRequestException(
+ "Couldn't parse one of the filter date, please
make "
+ + "sure it follows the ISO-8601 date or
date/time standard (yyyyMMddhhmmss). "
+ + e.toString());
+ }
+ }
}
- }
- }
- // Some additional validation on date format value
- if (startedDateFilter != null) {
- for (String ddf : startedDateFilter) {
- try {
- ISO8601DateParser.parse(getDateWithoutOp(ddf));
- } catch (ParseException e) {
- throw new InvalidRequestException(
- "Couldn't parse one of the filter date, please make "
- + "sure it follows the ISO-8601 date or date/time standard
(yyyyMMddhhmmss). "
- + e.toString());
+ if (lastActiveDateFilter != null) {
+ for (String ddf : lastActiveDateFilter) {
+ try {
+ ISO8601DateParser.parse(getDateWithoutOp(ddf));
+ } catch (ParseException e) {
+ throw new InvalidRequestException(
+ "Couldn't parse one of the filter date, please
make "
+ + "sure it follows the ISO-8601 date or
date/time standard (yyyyMMddhhmmss). "
+ + e.toString());
+ }
+ }
}
- }
- }
- if (lastActiveDateFilter != null) {
- for (String ddf : lastActiveDateFilter) {
- try {
- ISO8601DateParser.parse(getDateWithoutOp(ddf));
- } catch (ParseException e) {
- throw new InvalidRequestException(
- "Couldn't parse one of the filter date, please make "
- + "sure it follows the ISO-8601 date or date/time standard
(yyyyMMddhhmmss). "
- + e.toString());
+
+ if (orderKeys != null && orderKeys.length() > 0) {
+ orders = new ArrayList<String>(3);
+ for (StringTokenizer orderKeysTok = new StringTokenizer(orderKeys,
" "); orderKeysTok
+ .hasMoreTokens();) {
+ String orderKey = orderKeysTok.nextToken();
+ try {
+ String justKey = orderKey;
+ if (justKey.startsWith("-") || justKey.startsWith("+"))
+ justKey = orderKey.substring(1, justKey.length());
+ OrderKeys.valueOf(justKey.replaceAll("-",
"_").toUpperCase());
+ orders.add(orderKey);
+ } catch (IllegalArgumentException e) {
+ throw new InvalidRequestException(
+ "One of the ordering keys isn't valid, processes
can only "
+ + "be sorted by pid, name, namespace,
version, status, started and last-active "
+ + "date." + e.toString());
+
+ }
+ }
}
- }
+ if(limit<0) {
+ throw new IllegalArgumentException("Limit should be greater or
equal to 0.");
+ }
+ this.limit = limit;
}
- if (orderKeys != null && orderKeys.length() > 0) {
- orders = new ArrayList<String>(3);
- for (StringTokenizer orderKeysTok = new StringTokenizer(orderKeys, " ");
orderKeysTok
- .hasMoreTokens();) {
- String orderKey = orderKeysTok.nextToken();
- try {
- String justKey = orderKey;
- if (justKey.startsWith("-") || justKey.startsWith("+"))
- justKey = orderKey.substring(1, justKey.length());
- OrderKeys.valueOf(justKey.replaceAll("-", "_").toUpperCase());
- orders.add(orderKey);
- } catch (IllegalArgumentException e) {
- throw new InvalidRequestException(
- "One of the ordering keys isn't valid, processes can only "
- + "be sorted by pid, name, namespace, version, status,
started and last-active "
- + "date." + e.toString());
+ public InstanceFilter(String filter) {
+ this(filter, null, Integer.MAX_VALUE);
+ }
+ /**
+ * Converts the status filter value as given by a filter ('active',
+ * 'suspended', ...) to an instance state as defined in the ProcessState
+ * class.
+ *
+ * @return one of the STATE_XX constant in ProcessState
+ */
+ public List<Short> convertFilterState() {
+ List<Short> result = new ArrayList<Short>(5);
+ short noState = 200;
+ for (String status : statusFilter) {
+ if (StatusKeys.ACTIVE.toString().equalsIgnoreCase(status)) {
+ result.add(ProcessState.STATE_NEW);
+ result.add(ProcessState.STATE_ACTIVE);
+ result.add(ProcessState.STATE_READY);
+ } else if
(StatusKeys.SUSPENDED.toString().equalsIgnoreCase(status)) {
+ result.add(ProcessState.STATE_SUSPENDED);
+ } else if (StatusKeys.ERROR.toString().equalsIgnoreCase(status)) {
+ result.add(noState); // Error instance state doesn't exist yet
+ } else if
(StatusKeys.COMPLETED.toString().equalsIgnoreCase(status)) {
+ result.add(ProcessState.STATE_COMPLETED_OK);
+ } else if
(StatusKeys.TERMINATED.toString().equalsIgnoreCase(status)) {
+ result.add(ProcessState.STATE_TERMINATED);
+ } else if (StatusKeys.FAILED.toString().equalsIgnoreCase(status)) {
+ result.add(ProcessState.STATE_COMPLETED_WITH_FAULT);
+ } else {
+ result.add(noState); // Non existent state
+ }
}
- }
+ return result;
+ }
+
+ public String getNameFilter() {
+ return nameFilter;
+ }
+
+ public String getNamespaceFilter() {
+ return namespaceFilter;
}
- if(limit<0) {
- throw new IllegalArgumentException("Limit should be greater or equal
to 0.");
+
+ public List<String> getStatusFilter() {
+ return statusFilter;
}
- this.limit = limit;
- }
- public InstanceFilter(String filter) {
- this(filter, null, Integer.MAX_VALUE);
- }
-
- /**
- * Converts the status filter value as given by a filter ('active',
- * 'suspended', ...) to an instance state as defined in the ProcessState
- * class.
- *
- * @return one of the STATE_XX constant in ProcessState
- */
- public List<Short> convertFilterState() {
- List<Short> result = new ArrayList<Short>(5);
- short noState = 200;
- for (String status : statusFilter) {
- if ("active".equals(status)) {
- result.add(ProcessState.STATE_NEW);
- result.add(ProcessState.STATE_ACTIVE);
- result.add(ProcessState.STATE_READY);
- } else if ("suspended".equals(status)) {
- result.add(ProcessState.STATE_SUSPENDED);
- } else if ("error".equals(status)) {
- result.add(noState); // Error instance state doesn't exist yet
- } else if ("completed".equals(status)) {
- result.add(ProcessState.STATE_COMPLETED_OK);
- } else if ("terminated".equals(status)) {
- result.add(ProcessState.STATE_TERMINATED);
- } else if ("failed".equals(status)) {
- result.add(ProcessState.STATE_COMPLETED_WITH_FAULT);
- } else {
- result.add(noState); // Non existent state
- }
- }
- return result;
- }
-
- public String getNameFilter() {
- return nameFilter;
- }
-
- public String getNamespaceFilter() {
- return namespaceFilter;
- }
-
- public List<String> getStatusFilter() {
- return statusFilter;
- }
-
- public List<String> getStartedDateFilter() {
- return startedDateFilter;
- }
-
- public List<String> getLastActiveDateFilter() {
- return lastActiveDateFilter;
- }
-
- public Map<String, String> getPropertyValuesFilter() {
- return propertyValuesFilter;
- }
-
- public List<String> getOrders() {
- return orders;
- }
-
- public String getPidFilter() {
- return pid;
- }
-
- public String getIidFilter() {
- return iid;
- }
-
- public static void main(String[] args) {
- InstanceFilter instf = new InstanceFilter(
- "name = dtc* namespace=http://www.intalio.com* "
- + "status=active|terminated started>=2005-11-29T15:15:19
started<2005-11-29T15:15:20 last-active < 2005-11-30 "
- + "${http://ode.org/}order-id= 12 $shipping-id=aa45fz", "name
started", 50);
- System.out.println(instf);
- }
-
- @Override
- protected Criteria parseKey(String keyVal) {
- if (keyVal.startsWith("$")) return Criteria.PROPERTY;
- else return Criteria.valueOf(keyVal);
- }
-
- @Override
- protected Criteria[] getFilterKeys() {
- return Criteria.values();
- }
-
- @Override
- protected void process(Criteria key, Restriction<String> rest) {
- key.process(this, rest.originalKey, rest.op, rest.value);
- }
-
- /**
- * @return the limit
- */
- public int getLimit() {
- return limit;
- }
-
-
+ public List<String> getStartedDateFilter() {
+ return startedDateFilter;
+ }
+
+ public List<String> getLastActiveDateFilter() {
+ return lastActiveDateFilter;
+ }
+
+ public Map<String, String> getPropertyValuesFilter() {
+ return propertyValuesFilter;
+ }
+
+ public List<String> getOrders() {
+ return orders;
+ }
+
+ public String getPidFilter() {
+ return pid;
+ }
+
+ public String getIidFilter() {
+ return iid;
+ }
+
+ public static void main(String[] args) {
+ InstanceFilter instf = new InstanceFilter(
+ "name = dtc* namespace=http://www.intalio.com* "
+ + "status=active|terminated
started>=2005-11-29T15:15:19 started<2005-11-29T15:15:20 last-active <
2005-11-30 "
+ + "${http://ode.org/}order-id= 12
$shipping-id=aa45fz", "name started", 50);
+ System.out.println(instf);
+ }
+
+ @Override
+ protected Criteria parseKey(String keyVal) {
+ if (keyVal.startsWith("$")) return Criteria.PROPERTY;
+ else return Criteria.valueOf(keyVal);
+ }
+
+ @Override
+ protected Criteria[] getFilterKeys() {
+ return Criteria.values();
+ }
+
+ @Override
+ protected void process(Criteria key, Restriction<String> rest) {
+ key.process(this, rest.originalKey, rest.op, rest.value);
+ }
+
+ /**
+ * @return the limit
+ */
+ public int getLimit() {
+ return limit;
+ }
+
+
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java?view=diff&rev=443007&r1=443006&r2=443007
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
Wed Sep 13 09:04:45 2006
@@ -687,7 +687,10 @@
private void genInstanceSummaryEntry(TInstanceSummary.Instances instances,
TInstanceStatus.Enum state, ProcessDAO proc) {
instances.setState(state);
- InstanceFilter instanceFilter = new InstanceFilter(""); // TODO: put
this query back
+ String queryStatus =
InstanceFilter.StatusKeys.valueOf(state.toString()).toString().toLowerCase();
+ InstanceFilter instanceFilter = new InstanceFilter("status=" +
queryStatus
+ + " name=" + proc.getType().getLocalPart()
+ + " namespace=" + proc.getType().getNamespaceURI());
int count = _db.getConnection().instanceQuery(instanceFilter).size();
instances.setCount(count);
}