Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2012-01-12 00:02:56 +0000
committerEugene Tarassov2012-01-12 00:02:56 +0000
commite8a13b3509247e03cf14bcd870f06e6a714d68ea (patch)
treef36bf0292aa84df3980af513b592231c8ec6fcfc /plugins/org.eclipse.tcf.core
parent405c920e4161de3fafa0bb5bea21ec54d5acbd4a (diff)
downloadorg.eclipse.tcf-e8a13b3509247e03cf14bcd870f06e6a714d68ea.tar.gz
org.eclipse.tcf-e8a13b3509247e03cf14bcd870f06e6a714d68ea.tar.xz
org.eclipse.tcf-e8a13b3509247e03cf14bcd870f06e6a714d68ea.zip
Bug 367811 - For full system debug we need to specify which contexts breakpoints and configuration should apply to
Diffstat (limited to 'plugins/org.eclipse.tcf.core')
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ContextQueryProxy.java53
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IContextQuery.java94
2 files changed, 147 insertions, 0 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ContextQueryProxy.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ContextQueryProxy.java
new file mode 100644
index 000000000..62297b323
--- /dev/null
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ContextQueryProxy.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.internal.services.remote;
+
+import java.util.Collection;
+
+import org.eclipse.tcf.core.Command;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IContextQuery;
+
+public class ContextQueryProxy implements IContextQuery {
+
+ private final IChannel channel;
+
+ public ContextQueryProxy(IChannel channel) {
+ this.channel = channel;
+ }
+
+ public String getName() {
+ return NAME;
+ }
+
+ public IToken query(String query, final DoneQuery done) {
+ return new Command(channel, this, "query", new Object[]{ query }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ String[] contexts = null;
+ if (error == null) {
+ assert args.length == 2;
+ error = toError(args[0]);
+ contexts = toStringArray(args[1]);
+ }
+ done.doneQuery(token, error, contexts);
+ }
+ }.token;
+ }
+
+ @SuppressWarnings("unchecked")
+ private String[] toStringArray(Object o) {
+ if (o == null) return null;
+ Collection<String> c = (Collection<String>)o;
+ return (String[])c.toArray(new String[c.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IContextQuery.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IContextQuery.java
new file mode 100644
index 000000000..525ce6040
--- /dev/null
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IContextQuery.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.services;
+
+import org.eclipse.tcf.protocol.IService;
+import org.eclipse.tcf.protocol.IToken;
+
+/**
+ * ContextQuery allows to search for context that match a pattern.
+ *
+ * Query Syntax and Semantics
+ *
+ * query = [ "/" ], { part, "/" }, part ;
+ * part = string | "*" | "**" | properties ;
+ * properties = property, { ",", property } ;
+ * property = string, "=", value ;
+ * value = string | number | boolean ;
+ * string = quoted string | symbol ;
+ * quoted string = '"', {any-character - ('"' | '\') | ('\', ('"' | '\'))}, '"' ;
+ * symbol = letter, { letter | digit } ;
+ * number = digit, { digit } ;
+ * boolean = "true" | "false" ;
+ * letter = ? A-Z, a-z or _ ? ;
+ * digit = ? 0-9 ? ;
+ * any-character = ? any character ? ;
+ *
+ * To give a feel for the syntax, here are some examples, and what a user
+ * might mean when providing such a query:
+ *
+ * httpd
+ * Matches all contexts named "httpd".
+ *
+ * pid=4711
+ * Matches any context with a property pid, which has the value 4711.
+ *
+ * /server/**
+ * Matches all contexts which are decendants of the top level context
+ * named "server".
+ *
+ * "Linux 2.6.14"/Kernel/*
+ * Matches all kernel processes in operating systems named "Linux 2.6.14".
+ *
+ * pid=4711/*
+ * All threads in processes with the pid 4711.
+ *
+ * /server/** /HasState=true
+ * All threads which are decendants of the context "server".
+ *
+ * The contexts are assumed to be placed in a tree. Each context has zero
+ * or one parent. If it has zero parents it is a child of the root of the
+ * tree.
+ *
+ * A query consists of a sequence of parts separated by "/". This
+ * sequence specifies a path through the context tree. A context matches
+ * the query if the last part of the query matches the properties of the
+ * context and the parent of the context matches the query excluding the
+ * last part. The properties of a context matches a part if each property
+ * specified in the part matches the property of the same name in the
+ * context or if the name of the context matches the string specified in
+ * the part. There are also two wild cards. The part "*" matches any
+ * context. The part "**" matches any sequence of contexts. If the query
+ * starts with a "/" the first part of the query must match a child of
+ * the root of the context tree.
+ */
+public interface IContextQuery extends IService {
+
+ /**
+ * Service name.
+ */
+ static final String NAME = "ContextQuery";
+
+ IToken query(String query, DoneQuery done);
+
+ /**
+ * Call back interface for 'query' command.
+ */
+ interface DoneQuery {
+ /**
+ * Called when 'query' command is done.
+ * @param token - command handle.
+ * @param error - error object or null.
+ * @param contexts - array of context IDs.
+ */
+ void doneQuery(IToken token, Exception error, String[] contexts);
+ }
+}

Back to the top