Skip to content

Commit fefdfbc

Browse files
committed
load hubs by URL
1 parent 620afb8 commit fefdfbc

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Diff for: src/main/java/org/broad/igv/batch/CommandListener.java

+16-7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.broad.igv.ui.IGV;
3838
import org.broad.igv.ui.util.MessageUtils;
3939
import org.broad.igv.ui.util.UIUtilities;
40+
import org.broad.igv.util.LongRunningTask;
4041
import org.broad.igv.util.StringUtils;
4142

4243
import java.awt.*;
@@ -77,7 +78,7 @@ public class CommandListener implements Runnable {
7778
public static Set<String> indexParams;
7879

7980
static {
80-
String[] fps = new String[]{"file", "bigDataURL", "sessionURL", "dataURL"};
81+
String[] fps = new String[]{"file", "bigDataURL", "sessionURL", "dataURL", "hubURL"};
8182
fileParams = new LinkedHashSet<String>(Arrays.asList(fps));
8283
fileParams = Collections.unmodifiableSet(fileParams);
8384

@@ -182,9 +183,8 @@ private void processClientSession(CommandExecutor cmdExe) throws IOException {
182183
String cmd = inputLine;
183184
if (!cmd.contains("/oauthCallback")) {
184185
if (cmd.startsWith("SetAccessToken")) {
185-
log.info(cmd.substring(0,14) + " *****");
186-
}
187-
else {
186+
log.info(cmd.substring(0, 14) + " *****");
187+
} else {
188188
log.info(cmd);
189189
}
190190
}
@@ -224,7 +224,6 @@ private void processClientSession(CommandExecutor cmdExe) throws IOException {
224224
} else {
225225

226226
if (command != null) {
227-
228227
// Detect oauth callback
229228
if (command.equals("/oauthCallback")) {
230229
OAuthProvider provider = OAuthUtils.getInstance().getProviderForState(params.get("state"));
@@ -376,8 +375,18 @@ private String processGet(String command, Map<String, String> params, CommandExe
376375
mainFrame.setAlwaysOnTop(true);
377376
mainFrame.setAlwaysOnTop(false);
378377

379-
380-
if (command.equals("/load")) {
378+
if (command.equals("/")) {
379+
if (params.containsKey("hubURL")) {
380+
final String hubURL = URLDecoder.decode(params.get("hubURL")); // what if not encoded? Usually its not
381+
LongRunningTask.submit(() -> {
382+
try {
383+
GenomeManager.getInstance().loadGenome(hubURL, null);
384+
} catch (IOException e) {
385+
throw new RuntimeException(e);
386+
}
387+
});
388+
}
389+
} else if (command.equals("/load")) {
381390
String file = null;
382391
for (String fp : fileParams) {
383392
file = params.get(fp);

0 commit comments

Comments
 (0)