Skip to content

Commit

Permalink
pulled changes from master
Browse files Browse the repository at this point in the history
  • Loading branch information
soimugeo committed May 16, 2024
2 parents 16a1a86 + b61ca3a commit bdc7678
Show file tree
Hide file tree
Showing 23 changed files with 189 additions and 86 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Java CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Maven
run: mvn --batch-mode --update-snapshots package
29 changes: 29 additions & 0 deletions .github/workflows/pub-docker-hub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish Docker image to Docker Hub
on:
release:
types:
- published

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- uses: actions/checkout@v3
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
server-id: docker.io
server-username: DOCKER_USERNAME
server-password: DOCKER_PASSWORD
- name: Publish package
run: mvn --batch-mode clean deploy
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_TOKEN: ${{secrets.DOCKER_PASSWORD}}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-gwt-ui</artifactId>
<version>5.0.5-WHO</version>
<version>5.0.6-WHO</version>
<packaging>pom</packaging>

<properties>
Expand Down
57 changes: 2 additions & 55 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,3 @@
WebProtégé
==========
# webprotege-gwt-ui

What is WebProtégé?
-------------------

WebProtégé is a free, open source collaborative ontology development environment.

It provides the following features:
- Support for editing OWL 2 ontologies
- A default simple editing interface, which provides access to commonly used OWL constructs
- Full change tracking and revision history
- Collaboration tools such as, sharing and permissions, threaded notes and discussions, watches and email notifications
- Customizable user interface
- Support for editing OBO ontologies
- Multiple file formats for upload and download of ontologies (supported formats: RDF/XML, Turtle, OWL/XML, OBO, and others)

WebProtégé runs as a Web application. End users access it through their Web browsers.
They do not need to download or install any software. We encourage end-users to use

https://webprotege.stanford.edu

This repository houses the code for the WebProtege GWT User Interface.

Building
--------

To build WebProtégé from source

1) Clone the github repository
```
git clone https://github.com/protegeproject/webprotege-gwt-ui.git
```
2) Open a terminal in the directory where you clone the repository to
3) Use maven to package WebProtégé
```
mvn clean package
```
5) The WebProtege .war file will be built into the webprotege-server directory

Running from Maven
------------------

To run WebProtégé in SuperDev Mode using maven

1) Start the GWT code server in one terminal window
```
mvn gwt:codeserver
```
2) In a different terminal window start the tomcat server
```
mvn -Denv=dev tomcat7:run
```
3) Start the WebProtégé Backend
4) Browse to WebProtégé in a Web browser by navigating to [http://localhost:8080](http://localhost:8080)
This is the UI server for WebProtégé.
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-gwt-ui</artifactId>
<version>5.0.5-WHO</version>
<version>5.0.6-WHO</version>
</parent>

<artifactId>webprotege-gwt-ui-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import edu.stanford.bmir.protege.web.client.progress.BusyView;
import edu.stanford.bmir.protege.web.client.tag.ProjectTagsStyleManager;
import edu.stanford.bmir.protege.web.client.topbar.TopBarPresenter;
import edu.stanford.bmir.protege.web.client.user.LoggedInUserProvider;
import edu.stanford.bmir.protege.web.shared.HasDispose;
import edu.stanford.bmir.protege.web.shared.dispatch.actions.GetUserInfoAction;
import edu.stanford.bmir.protege.web.shared.dispatch.actions.TranslateEventListAction;
import edu.stanford.bmir.protege.web.shared.event.*;
import edu.stanford.bmir.protege.web.shared.inject.ProjectSingleton;
Expand Down Expand Up @@ -59,6 +61,8 @@ public class ProjectPresenter implements HasDispose, HasProjectId {

private final LargeNumberOfChangesManager largeNumberOfChangesHandler;

private final LoggedInUserProvider loggedInUserProvider;


@Inject
public ProjectPresenter(ProjectId projectId,
Expand All @@ -72,7 +76,7 @@ public ProjectPresenter(ProjectId projectId,
PermissionScreener permissionScreener,
WebProtegeEventBus eventBus,
ProjectTagsStyleManager projectTagsStyleManager,
LargeNumberOfChangesManager largeNumberOfChangesHandler) {
LargeNumberOfChangesManager largeNumberOfChangesHandler, LoggedInUserProvider loggedInUserProvider) {
this.projectId = projectId;
this.view = view;
this.busyView = busyView;
Expand All @@ -85,6 +89,7 @@ public ProjectPresenter(ProjectId projectId,
this.eventBus = eventBus;
this.projectTagsStyleManager = projectTagsStyleManager;
this.largeNumberOfChangesHandler = largeNumberOfChangesHandler;
this.loggedInUserProvider = loggedInUserProvider;
}

@Nonnull
Expand All @@ -109,7 +114,11 @@ private void displayProject(@Nonnull AcceptsOneWidget container,
@Nonnull ProjectViewPlace place) {
dispatchServiceManager.execute(new LoadProjectAction(projectId),
result -> handleProjectLoaded(container, eventBus, place));
subscribeToWebsocket(projectId.getId());
dispatchServiceManager.execute(new GetUserInfoAction(), r -> {
subscribeToWebsocket(projectId.getId(), r.getToken(), this.loggedInUserProvider.getCurrentUserId().getUserName());

});

}

private void handleProjectLoaded(@Nonnull AcceptsOneWidget container, @Nonnull EventBus eventBus, @Nonnull ProjectViewPlace place) {
Expand All @@ -122,6 +131,7 @@ private void handleProjectLoaded(@Nonnull AcceptsOneWidget container, @Nonnull E
projectId,
largeNumberOfChangesHandler);
container.setWidget(view);

dispatchServiceManager.execute(GetProjectTagsAction.create(projectId),
r -> projectTagsStyleManager.setProjectTags(r.getTags(), view));
dispatchServiceManager.executeCurrentBatch();
Expand All @@ -147,7 +157,7 @@ public void dispatchEventsFromWebsocket(String data) {

}
/*TODO change the hardcoded broker URL and get it from a config class */
public native void subscribeToWebsocket(String projectId)/*-{
public native void subscribeToWebsocket(String projectId, String token, String userId)/*-{
try {
var that = this;
Expand All @@ -156,17 +166,22 @@ public native void subscribeToWebsocket(String projectId)/*-{
debug: function(str) {
console.log(str);
},
reconnectDelay: 5000,
reconnectDelay: 30000,
heartbeatIncoming: 4000,
heartbeatOutgoing: 4000,
});
stompClient.onConnect = function(frame) {
var headers = {
'token': token,
'userId': userId,
'Authorization' : 'Bearer ' + token
};
stompClient.subscribe('/topic/project-events/' + projectId, function(message) {
that.@edu.stanford.bmir.protege.web.client.project.ProjectPresenter::dispatchEventsFromWebsocket(Ljava/lang/String;)(message.body);
});
}, headers);
};
stompClient.onWebSocketError = function(error) {
console.error('Error with websocket', error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import edu.stanford.bmir.protege.web.client.permissions.PermissionManager;
import edu.stanford.bmir.protege.web.client.progress.BusyView;
import edu.stanford.bmir.protege.web.client.settings.SettingsPresenter;
import edu.stanford.bmir.protege.web.client.uuid.UuidV4Provider;
import edu.stanford.bmir.protege.web.shared.perspective.ChangeRequestId;
import edu.stanford.bmir.protege.web.shared.project.ProjectId;
import edu.stanford.bmir.protege.web.shared.sharing.GetProjectSharingSettingsAction;
import edu.stanford.bmir.protege.web.shared.sharing.ProjectSharingSettings;
Expand Down Expand Up @@ -63,13 +65,17 @@ public class SharingSettingsPresenter implements Presenter {
@Nonnull
private final ProgressDisplay progressDisplay;

@Nonnull
private UuidV4Provider uuidV4Provider;

@Inject
public SharingSettingsPresenter(@Nonnull ProjectId projectId,
@Nonnull SharingSettingsView view,
@Nonnull BusyView busyView,
@Nonnull DispatchServiceManager dispatchServiceManager,
@Nonnull PermissionManager permissionManager,
@Nonnull PermissionScreener permissionScreener,
@Nonnull UuidV4Provider uuidV4Provider,
@Nonnull SettingsPresenter settingsPresenter,
@Nonnull Messages messages, @Nonnull DispatchErrorMessageDisplay errorDisplay, @Nonnull ProgressDisplay progressDisplay) {
this.projectId = checkNotNull(projectId);
Expand All @@ -81,6 +87,7 @@ public SharingSettingsPresenter(@Nonnull ProjectId projectId,
this.settingsPresenter = checkNotNull(settingsPresenter);
this.messages = checkNotNull(messages);
this.errorDisplay = checkNotNull(errorDisplay);
this.uuidV4Provider = uuidV4Provider;
this.progressDisplay = checkNotNull(progressDisplay);
}

Expand Down Expand Up @@ -113,7 +120,7 @@ private void displaySharingSettings(AcceptsOneWidget container) {
private void applyChangesAndGoToNextPlace() {
settingsPresenter.goToNextPlace();
ProjectSharingSettings settings = new ProjectSharingSettings(projectId, view.getLinkSharingPermission(), view.getSharingSettings());
dispatchServiceManager.execute(SetProjectSharingSettingsAction.create(settings), new DispatchServiceCallbackWithProgressDisplay<SetProjectSharingSettingsResult>(errorDisplay, progressDisplay) {
dispatchServiceManager.execute(SetProjectSharingSettingsAction.create(settings, ChangeRequestId.get(uuidV4Provider.get()), this.projectId), new DispatchServiceCallbackWithProgressDisplay<SetProjectSharingSettingsResult>(errorDisplay, progressDisplay) {
@Override
public void handleSuccess(SetProjectSharingSettingsResult result) {
permissionManager.firePermissionsChanged();
Expand Down
5 changes: 5 additions & 0 deletions webprotege-gwt-ui-client/src/main/module-dev.gwt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@

<set-property name="locale" value="en"/>

<!-- <set-property name="webprotege.brokerUrl" value="ws://webprotege-local.edu/wsapps"/>
<set-property name="webprotege.reconnectDelay" value="5000"/>
<set-property name="webprotege.heartbeatIncoming" value="4000"/>
<set-property name="webprotege.heartbeatOutgoing" value="4000"/>-->

<extend-configuration-property name="rpc.blacklist" value="+com.google.web.bindery.event.shared.Event"/>

<entry-point class="edu.stanford.bmir.protege.web.client.WebProtege"/>
Expand Down
5 changes: 5 additions & 0 deletions webprotege-gwt-ui-client/src/main/module.gwt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
<extend-property name="locale" values="sl"/>
<extend-property name="locale" values="pt"/>

<!-- <set-property name="webprotege.brokerUrl" value="ws://webprotege-local.edu/wsapps"/>
<set-property name="webprotege.reconnectDelay" value="5000"/>
<set-property name="webprotege.heartbeatIncoming" value="4000"/>
<set-property name="webprotege.heartbeatOutgoing" value="4000"/>-->

<extend-configuration-property name="rpc.blacklist" value="+com.google.web.bindery.event.shared.Event"/>

<entry-point class="edu.stanford.bmir.protege.web.client.WebProtege"/>
Expand Down
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-server-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>webprotege-gwt-ui</artifactId>
<groupId>edu.stanford.protege</groupId>
<version>5.0.5-WHO</version>
<version>5.0.6-WHO</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import edu.stanford.bmir.protege.web.server.rpc.JsonRpcHttpRequestBuilder;
import edu.stanford.bmir.protege.web.server.rpc.JsonRpcHttpResponseHandler;
import edu.stanford.bmir.protege.web.shared.dispatch.*;
import edu.stanford.bmir.protege.web.shared.dispatch.actions.GetUserInfoAction;
import edu.stanford.bmir.protege.web.shared.dispatch.actions.GetUserInfoResult;
import edu.stanford.bmir.protege.web.shared.dispatch.actions.TranslateEventListAction;
import edu.stanford.bmir.protege.web.shared.event.GetProjectEventsResult;
import edu.stanford.bmir.protege.web.shared.permissions.PermissionDeniedException;
Expand Down Expand Up @@ -59,6 +61,10 @@ public <A extends Action<R>, R extends Result> DispatchServiceResultContainer ex
GetProjectEventsResult result = objectMapper.readValue(translateEventsAction.getEventList(), GetProjectEventsResult.class);
return DispatchServiceResultContainer.create(result);
}
if(action instanceof GetUserInfoAction) {
GetUserInfoResult result = GetUserInfoResult.create(executionContext.getToken());
return DispatchServiceResultContainer.create(result);
}
var result = sendRequest(action, executionContext);
return DispatchServiceResultContainer.create(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void shouldSerializeAction() throws IOException {
Optional.of(SharingPermission.EDIT), ImmutableList.of(
new SharingSetting(PersonId.get("User"), SharingPermission.EDIT)
)
));
), null, null);
JsonSerializationTestUtil.testSerialization(action, Action.class);
}

Expand Down
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-gwt-ui</artifactId>
<version>5.0.5-WHO</version>
<version>5.0.6-WHO</version>
</parent>

<artifactId>webprotege-gwt-ui-server</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-shared-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>webprotege-gwt-ui</artifactId>
<groupId>edu.stanford.protege</groupId>
<version>5.0.5-WHO</version>
<version>5.0.6-WHO</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion webprotege-gwt-ui-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>edu.stanford.protege</groupId>
<artifactId>webprotege-gwt-ui</artifactId>
<version>5.0.5-WHO</version>
<version>5.0.6-WHO</version>
</parent>

<artifactId>webprotege-gwt-ui-shared</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@
@JsonSubTypes.Type(UpdateObjectPropertyFrameResult.class),
@JsonSubTypes.Type(UpdateDataPropertyFrameResult.class),
@JsonSubTypes.Type(UpdateAnnotationPropertyFrameResult.class),
@JsonSubTypes.Type(UpdateNamedIndividualFrameResult.class)
@JsonSubTypes.Type(UpdateNamedIndividualFrameResult.class),
@JsonSubTypes.Type(GetUserInfoResult.class)
})
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME)
public interface Result extends IsSerializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,8 @@ public class RpcWhiteList implements IsSerializable, Action, Result {

DropType _DropType;

GetUserInfoResult _GetUserInfoResult;

public RpcWhiteList() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package edu.stanford.bmir.protege.web.shared.dispatch.actions;

import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.gwt.user.client.rpc.IsSerializable;
import edu.stanford.bmir.protege.web.shared.dispatch.Action;
import java.io.Serializable;

@JsonTypeName("webprotege.users.GetUserInfo")
public class GetUserInfoAction implements Action<GetUserInfoResult>, Serializable, IsSerializable {

}
Loading

0 comments on commit bdc7678

Please sign in to comment.