aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCheng Chen2012-04-30 21:37:29 (EDT)
committerCheng Chen2012-04-30 21:37:29 (EDT)
commite8c2019f8db86c480d24881d554f1290b7fd3588 (patch)
tree20ef73a57e5d399658fcf89937d66cd0d96aa62d
parent68a9318b39559bd0fa8616adbb086cd213acebd6 (diff)
downloadorg.eclipse.recommenders-e8c2019f8db86c480d24881d554f1290b7fd3588.zip
org.eclipse.recommenders-e8c2019f8db86c480d24881d554f1290b7fd3588.tar.gz
org.eclipse.recommenders-e8c2019f8db86c480d24881d554f1290b7fd3588.tar.bz2
[snipmatch] Local search module interface define for SnipMatchrefs/changes/89/5689/2
Include search client switcher abstract class, searchclient interface define and SnipMatchSearchEngine interface define. Signed-off-by: Cheng Chen <chengchendoc@gmail.com> Change-Id: I38a4926f6e5cbc7499cb49c832551c2996b97ed1
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/ClientSwitcher.java9
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SearchClient.java53
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SnipMatchSearchEngine.java31
3 files changed, 93 insertions, 0 deletions
diff --git a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/ClientSwitcher.java b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/ClientSwitcher.java
new file mode 100644
index 0000000..f493112
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/ClientSwitcher.java
@@ -0,0 +1,9 @@
+package org.eclipse.recommenders.snipmatch.search;
+
+public abstract class ClientSwitcher {
+ protected SearchClient client;
+
+ public void setSearchClient(SearchClient c){
+ client = c;
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SearchClient.java b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SearchClient.java
new file mode 100644
index 0000000..0e582b6
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SearchClient.java
@@ -0,0 +1,53 @@
+package org.eclipse.recommenders.snipmatch.search;
+
+import org.eclipse.recommenders.snipmatch.core.Effect;
+import org.eclipse.recommenders.snipmatch.core.MatchEnvironment;
+import org.eclipse.recommenders.snipmatch.core.MatchNode;
+import org.eclipse.recommenders.snipmatch.web.IDeleteEffectListener;
+import org.eclipse.recommenders.snipmatch.web.ILoadProfileListener;
+import org.eclipse.recommenders.snipmatch.web.ILoginListener;
+import org.eclipse.recommenders.snipmatch.web.ISearchListener;
+import org.eclipse.recommenders.snipmatch.web.ISendFeedbackListener;
+import org.eclipse.recommenders.snipmatch.web.ISubmitEffectListener;
+
+public interface SearchClient {
+
+ public void startSearch(String query, MatchEnvironment env, ISearchListener listener);
+
+ public void cancelWork();
+
+ public boolean isWorking();
+
+ public boolean isLoggedIn();
+
+ public void logout();
+
+ public String getUsername();
+
+ public String getPassword();
+
+ public String getName();
+
+ public String getVersion();
+
+ public void startProcessing();
+
+ public void stopProcessing();
+
+ public void setServerProcessingTime(float serverProcessingTime);
+
+ public float getServerProcessingTime();
+
+ public float getProcessingTime();
+
+ public void startSendFeedback(String query, MatchNode result, String comment, int rating, boolean flag,
+ boolean isLog, boolean isStartup, long clientId, boolean used, ISendFeedbackListener listener);
+
+ public void startLogin(String username, String password, ILoginListener listener);
+
+ public void startDeleteEffect(Effect effect, IDeleteEffectListener listener);
+
+ public void startSubmitEffect(Effect effect, boolean isPublic, ISubmitEffectListener listener);
+
+ public void startLoadProfile(ILoadProfileListener listener);
+}
diff --git a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SnipMatchSearchEngine.java b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SnipMatchSearchEngine.java
new file mode 100644
index 0000000..96fa6f2
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SnipMatchSearchEngine.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2012 University of Science and Technology Beijing.
+ * 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:
+ * Cheng Chen - initial API and implementation.
+ */
+package org.eclipse.recommenders.snipmatch.search;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.recommenders.snipmatch.core.MatchNode;
+
+public interface SnipMatchSearchEngine {
+
+ //Confirm whether current search engine is initialized by current snippetsDir and indexDir
+ public boolean isInitialized(String snippetsDir, String indexDir);
+
+ //Initialize search engine
+ public void initialize(String snippetsDir, String indexDir) throws IOException;
+
+ public void updateIndex();
+
+ //Snippets search entrance, return match node list
+ public List<MatchNode> search(final String query);
+
+}