Skip to content

Commit

Permalink
chore(release): 0.0.19 (#45)
Browse files Browse the repository at this point in the history
* feat: Normalize method responses (#36)

* chore: JSON library (#37)

* chore: Add org.json dependency

* chore: Add JSON usage example

* feat: Config from env vars (#38)

* feat: Get conf from env vars

* docs: Add CLI.md document

* docs: Link docs in README

* feat: Add default ENV vars to Dockerfile for convenience

* fix: Change worker RMI default port

* feat: adding register implementation and some changes in .gitignore (#35)

* feat: adding register implementation and some changes in .gitignore

* fix: fixing format inconsistencies

* feat: changing and upgrading res in success

* fix: upgrading requests and responses

* fix: changing parameter from pass to password

* fix: changing url format

* fix: clang format

* fix: True on success

* fix: Use Config class for env vars

---------

Co-authored-by: woynert

* Feat login (#40)

* Feat login without tests

* Apply formatting

* docs: SOAP OpenAPI specification (#41)

* docs: Add open api specification

* docs: Add API definition to README.md

* docs: Improve CLI.md examples

* refactor: Redesign request / response types

* chore: Update python sample client

* chore: Update submodule

* chore: Use error instead of success

* chore: Apply requested changes

---------

Co-authored-by: Antonio Donis <[email protected]>
Co-authored-by: Silvia Pabón <[email protected]>
Co-authored-by: Andres David Bonilla Higuera <[email protected]>
  • Loading branch information
4 people authored Sep 26, 2023
1 parent 56ed1d8 commit 0ba73d1
Show file tree
Hide file tree
Showing 40 changed files with 994 additions and 138 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ build

node_modules

*volume
*volume

# Ignore bin folder
**bin/

# Ignore internal config staff about some IDEs
**.vscode/
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### 0.0.19 (2023-09-23)

### 0.0.18 (2023-09-23)

### 0.0.17 (2023-09-17)


### Features

* adding register implementation and some changes in .gitignore ([#35](https://github.com/hawks-atlanta/gateway-java/issues/35)) ([8dc5bbe](https://github.com/hawks-atlanta/gateway-java/commit/8dc5bbe7538a1d927488306419594ac95db197ba))

### 0.0.16 (2023-09-15)


### Features

* Config from env vars ([#38](https://github.com/hawks-atlanta/gateway-java/issues/38)) ([9e32329](https://github.com/hawks-atlanta/gateway-java/commit/9e32329e3390a2b5b9c5cedb62ea6017d31b28f4))

### 0.0.15 (2023-09-13)

### 0.0.14 (2023-09-13)


### Features

* Normalize method responses ([#36](https://github.com/hawks-atlanta/gateway-java/issues/36)) ([914a1e7](https://github.com/hawks-atlanta/gateway-java/commit/914a1e7c9414c7e51cbdc3bd1b31bee7fbb7aa70))

### 0.0.13 (2023-09-13)

### 0.0.12 (2023-09-11)

### 0.0.11 (2023-09-02)
Expand Down
12 changes: 12 additions & 0 deletions CLI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# CLI

This document describes how to use the service as a CLI tool.

## Environment variables

| Variable | Description | Example |
|--------------------------|-----------------------------|-------------------------|
| `AUTHENTICATION_BASEURL` | Authentication service host | `http://127.0.0.1:8081` |
| `METADATA_BASEURL` | Metadata service host | `http://127.0.0.1:8082` |
| `WORKER_HOST` | Worker service host | `127.0.0.1` |
| `WORKER_PORT` | Worker service RMI port | `1099` |
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ RUN ./gradlew build
FROM adoptopenjdk/openjdk11:x86_64-alpine-jre-11.0.20_8

COPY --from=builder /src/app/build/libs/app-all.jar /opt/app.jar

EXPOSE 8080/tcp
ENV AUTHENTICATION_BASEURL "127.0.0.1"
ENV METADATA_BASEURL "127.0.0.1"
ENV WORKER_HOST "127.0.0.1"
ENV WORKER_PORT "1099"

CMD ["java", "-jar", "/opt/app.jar"]
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
[![Tagging](https://github.com/hawks-atlanta/gateway-java/actions/workflows/tagging.yaml/badge.svg)](https://github.com/hawks-atlanta/gateway-java/actions/workflows/tagging.yaml)
[![Test](https://github.com/hawks-atlanta/gateway-java/actions/workflows/testing.yml/badge.svg)](https://github.com/hawks-atlanta/gateway-java/actions/workflows/testing.yml)

Microservice to expose main CapyFile services.

## Documentation

| Document | URL |
|-----------------------------|------------------------------------------------------------------------------------|
| CLI documentation | [CLI.md](CLI.md) |
| CICD | [CICD.md](https://github.com/hawks-atlanta/docs/blob/main/CICD.md) |
| CONTRIBUTING | [CONTRIBUTING.md](https://github.com/hawks-atlanta/docs/blob/main/CONTRIBUTING.md) |
| SOAP Java interfaces | [Service.java](app/src/main/java/gateway/soap/Service.java) |
| SOAP service API definition | [Specification](docs/spec.openapi.yml) |

## Development

### Submodules
Expand Down
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ dependencies {

// This dependency is used by the application.
implementation 'com.google.guava:guava:31.1-jre'

// JSON library
// https://mvnrepository.com/artifact/org.json/json
implementation 'org.json:json:20230618'

// --- SOAP service ---

Expand Down
34 changes: 5 additions & 29 deletions app/src/main/java/gateway/App.java
Original file line number Diff line number Diff line change
@@ -1,43 +1,19 @@
package gateway;

import capyfile.rmi.interfaces.*;
import gateway.soap.*;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import gateway.config.Config;
import gateway.soap.ServiceImp;
import javax.xml.ws.Endpoint;

public class App
{
public static void main (String[] args)
{
System.out.println ("Gateway: RMI demo");

// consume RMI
try {
// get service

Registry registry = LocateRegistry.getRegistry (1900);
IWorkerService server = (IWorkerService)registry.lookup ("WorkerService");

// TODO: Replace me

File queryUpload = new File ("----", null);
server.uploadFile (queryUpload);

FileDownload queryDownload = new FileDownload ("----");
File resultFile = server.downloadFile (queryDownload);

System.out.println (resultFile.uuid);

} catch (Exception e) {
System.err.println (e);
}
// init config from env vars
Config.initializeFromEnv ();

// serve SOAP
System.out.println ("Gateway: Starting SOAP");

// serve SOAP
Endpoint.publish ("http://0.0.0.0:8080/service", new ServiceImp ());
}
}
24 changes: 24 additions & 0 deletions app/src/main/java/gateway/config/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package gateway.config;

public class Config
{
private static String authBaseUrl;
private static String metadataBaseUrl;
private static String workerHost;
private static int workerPort;

public static String getAuthBaseUrl () { return authBaseUrl; }
public static String getMetadataBaseUrl () { return metadataBaseUrl; }
public static String getWorkerHost () { return workerHost; }
public static int getWorkerPort () { return workerPort; }

public static void initializeFromEnv ()
{
authBaseUrl =
System.getenv ().getOrDefault ("AUTHENTICATION_BASEURL", "http://127.0.0.1:8081");
metadataBaseUrl =
System.getenv ().getOrDefault ("METADATA_BASEURL", "http://127.0.0.1:8082");
workerHost = System.getenv ().getOrDefault ("WORKER_HOST", "127.0.0.1");
workerPort = Integer.parseInt (System.getenv ().getOrDefault ("WORKER_PORT", "1099"));
}
}
32 changes: 19 additions & 13 deletions app/src/main/java/gateway/soap/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,39 @@
public interface Service {
// auth

@WebMethod Authorization login (Credentials credentials);
@WebMethod ResSession auth_login (Credentials credentials);

@WebMethod Authorization register(Credentials credentials);
@WebMethod ResSession auth_refresh (Authorization auth);

@WebMethod StatusRes updatePassword (UpdatePasswordReq parameters);
// account

@WebMethod ResSession account_register (Credentials credentials);

@WebMethod ResStatus account_password (ReqAccPassword parameters);

// file system

@WebMethod StatusRes createFile (CreateFileReq args);
@WebMethod ResFileList file_list (ReqFileList args);

@WebMethod ResFileNew file_upload (ReqFileUpload args);

@WebMethod StatusRes createDirectory (CreateDirectoryReq args);
@WebMethod ResFileNew file_new_dir (ReqFileNewDir args);

@WebMethod StatusRes deleteFile (DeleteFileReq args);
@WebMethod ResFileCheck file_check (ReqFile args);

@WebMethod File[] listFiles (ListFileReq args);
@WebMethod ResStatus file_delete (ReqFileDelete args);

@WebMethod FileContents downloadFile (DownloadFileReq args);
@WebMethod ResFileDownload file_download (ReqFile args);

@WebMethod StatusRes moveFile (MoveFileReq args);
@WebMethod ResStatus file_move (ReqFileMove args);

// sharing

@WebMethod StatusRes shareWith (ShareWithReq args);
@WebMethod ResStatus share_file (ReqShareFile args);

@WebMethod StatusRes unShareWith (UnShareWithReq args);
@WebMethod ResStatus unshare_file (ReqShareRemove args);

@WebMethod User[] sharedWithWho (SharedWithWhoReq args);
@WebMethod ResShareList share_list (Authorization auth);

@WebMethod SharedFile[] listSharedWithMe (Authorization auth);
@WebMethod ResShareListWithWho share_list_with_who (ReqFile args);
}
Loading

0 comments on commit 0ba73d1

Please sign in to comment.