Skip to content

Commit

Permalink
Merge pull request #227 from ZihengSun/master
Browse files Browse the repository at this point in the history
Add python environment extractor, fix the lost websocket problem, fix the multihost-selector
  • Loading branch information
ZihengSun authored Oct 5, 2021
2 parents 087c1b0 + c697b1e commit fe9d136
Show file tree
Hide file tree
Showing 59 changed files with 2,924 additions and 836 deletions.
33 changes: 33 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

jobs:
# Below is the definition of your job to build and test your app, you can rename and customize it as you want.
build-and-test:
# These next lines define a Docker executor: https://circleci.com/docs/2.0/executor-types/
# You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# Be sure to update the Docker image tag below to openjdk version of your application.
# A list of available CircleCI Docker Convenience Images are available here: https://circleci.com/developer/images/image/cimg/openjdk
docker:
- image: cimg/openjdk:11.0
steps:
# Checkout the code as the first step.
- checkout
# Use mvn clean and package as the standard maven build phase
- run:
name: Build
command: mvn -B -DskipTests clean package
# Then run your tests!
- run:
name: Test
command: mvn test

workflows:
# Below is the definition of your workflow.
# Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above.
# CircleCI will run this workflow on every commit.
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
sample:
jobs:
- build-and-test
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Launch TempTest",
"request": "launch",
"mainClass": "com.TempTest",
"projectName": "geoweaver"
},
{
"type": "java",
"name": "Launch GmailAPI",
Expand Down
55 changes: 51 additions & 4 deletions src/main/java/com/gw/GeoweaverApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.net.URISyntaxException;

import com.gw.jpa.GWUser;
import com.gw.jpa.Host;
import com.gw.tools.HostTool;
import com.gw.tools.UserTool;
import com.gw.utils.BeanTool;

Expand All @@ -22,17 +24,56 @@ public static void main(String[] args) {
// BasicConfigurator.configure();

SpringApplication.run(GeoweaverApplication.class, args);
// browse("http://localhost:8070/Geoweaver/");


// openHomePage();
openHomePage();

addDefaultPublicUser();


addLocalhost();

}

public static void addLocalhost(){

HostTool ht = BeanTool.getBean(HostTool.class);

Host h = ht.getHostById("100001");

if(h==null){

System.out.println("Localhost doesn't exist. Adding now..");

h = new Host();

h.setId("100001");

h.setIp("127.0.0.1");

h.setConfidential("FALSE");

h.setName("Localhost");

h.setOwner("111111");

h.setPort("22");

h.setType("ssh");

h.setUrl("http://localhost/");

h.setUsername("publicuser");

ht.save(h);

}else{

System.out.println("Localhost exists.");

}


}

public static void addDefaultPublicUser(){

//fixed public user "public_user", id: "111111"
Expand Down Expand Up @@ -72,6 +113,12 @@ public static void addDefaultPublicUser(){
ut.belongToPublicUser();

}

public static void openHomePage(){

browse("http://localhost:8070/Geoweaver/");

}

public static void browse(String url) {
if(Desktop.isDesktopSupported()){
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/gw/database/EnvironmentRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.springframework.data.repository.CrudRepository;

import com.gw.jpa.Environment;
import com.gw.jpa.History;

public interface EnvironmentRepository extends CrudRepository<Environment, String>{

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/gw/database/LogActivityRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.gw.database;

import com.gw.jpa.LogActivity;

import org.springframework.data.repository.CrudRepository;

/**
* Log Activity Repository
*/
interface LogActivityRepository extends CrudRepository<LogActivity, String>{



}
8 changes: 4 additions & 4 deletions src/main/java/com/gw/database/ProcessRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ public interface ProcessRepository extends CrudRepository<GWProcess, String>{
nativeQuery = true)
Collection<GWProcess> findProcessesByNameAlike(@Param("keyword") String keyword);

@Query(value="select * from gwprocess where description = 'python'",
@Query(value="select * from gwprocess where lang = 'python'",
nativeQuery = true)
Collection<GWProcess> findPythonProcess();

@Query(value="select * from gwprocess where owner in ('111111', ?1)",
nativeQuery = true)
Collection<GWProcess> findAllPublicPrivateByOwner(String owner);

@Query(value="select * from gwprocess where description = 'shell'",
@Query(value="select * from gwprocess where lang = 'shell'",
nativeQuery = true)
Collection<GWProcess> findShellProcess();

@Query(value="select * from gwprocess where description = 'builtin'",
@Query(value="select * from gwprocess where lang = 'builtin'",
nativeQuery = true)
Collection<GWProcess> findBuiltinProcess();

@Query(value="select * from gwprocess where description = 'jupyter'",
@Query(value="select * from gwprocess where lang = 'jupyter'",
nativeQuery = true)
Collection<GWProcess> findNotebookProcess();

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/gw/jpa/Environment.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gw.jpa;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

Expand All @@ -10,7 +11,10 @@ public class Environment {
@Id
String id;

String name, type, bin, pyenv, host, basedir, settings;
String name, type, bin, pyenv, host, basedir;

@Column(columnDefinition = "LONGTEXT")
String settings;

public String getId() {
return id;
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/gw/jpa/GWProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public class GWProcess {
@Column(columnDefinition = "LONGTEXT")
String code;

String lang;



String owner;

//true: private; false: public
Expand All @@ -47,7 +51,13 @@ public void setConfidential(String confidential) {
this.confidential = confidential;
}

public String getLang() {
return this.lang;
}

public void setLang(String lang) {
this.lang = lang;
}


public String getId() {
Expand Down
72 changes: 72 additions & 0 deletions src/main/java/com/gw/jpa/LogActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.gw.jpa;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class LogActivity {

@Id
String id;

String operator;

String category;

String objectid;

String objname;

String operation;

public String getObjname() {
return this.objname;
}

public void setObjname(String objname) {
this.objname = objname;
}

public String getId() {
return this.id;
}

public void setId(String id) {
this.id = id;
}

public String getOperator() {
return this.operator;
}

public void setOperator(String operator) {
this.operator = operator;
}

public String getCategory() {
return this.category;
}

public void setCategory(String category) {
this.category = category;
}

public String getObjectid() {
return this.objectid;
}

public void setObjectid(String objectid) {
this.objectid = objectid;
}

public String getOperation() {
return this.operation;
}

public void setOperation(String operation) {
this.operation = operation;
}



}
14 changes: 7 additions & 7 deletions src/main/java/com/gw/jpa/Workflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ public class Workflow {
private String name, description, owner;

private String confidential;

@Column(columnDefinition = "LONGTEXT")
private String edges;

@Column(columnDefinition = "LONGTEXT")
private String nodes;


public String getConfidential() {
return this.confidential;
}
Expand All @@ -23,14 +30,7 @@ public void setConfidential(String confidential) {
this.confidential = confidential;
}



@Column(columnDefinition = "LONGTEXT")
private String edges;

@Column(columnDefinition = "LONGTEXT")
private String nodes;

public String getDescription() {
return description;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/gw/local/LocalSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public interface LocalSession {
* @return
*/
public boolean stop();

/**
* Find all python environments on the localhost
* @return
*/
public String readPythonEnvironment(String hostid, String password);

// public void setWebSocketSession(WebSocketSession session);
/**
Expand Down
Loading

0 comments on commit fe9d136

Please sign in to comment.