Code Monkey home page Code Monkey logo

nlighten's Introduction

nlighten

Gitter

Build Status

nlighten's People

Contributors

lubo3 avatar matus-m avatar mersenne255 avatar ibaneeez avatar

Stargazers

Dorin Brage avatar

Watchers

Andrej Petras avatar James Cloos avatar  avatar Dorin Brage avatar  avatar  avatar  avatar  avatar

Forkers

gitter-badger

nlighten's Issues

create generic DAO service

Implement a DAO service that could perform basic CRUD operations on given entity. The class should be generic, with entity class as generic type. Inject the EntityManager and implement the basic DB operations.
Few notes: distinguish between persist(create) and merge(update), search for implemntations on github or use Spring CRUD repository as an inspiration

DAOException hides cause

DAOException hides the cause by ignoring it in its constructor:

 public DAOException(Enum<?> messageKey, Object... arguments) {
    this.messageKey = messageKey;
    this.arguments = arguments;
  }

Either check the array args for the presence of exception, or add cause as required constructor param.

Also remove all constructors, that take String as argument. It is pointless to allow raw strings as parameters, as there is no way to i18n them. Only allow enums, Exceptions, and params.

File upload/download service

Our course related work will require a robust way to upload and download assets associated with lectures, assignments etc.
A very general requirements:

  • ability to upload any file via REST api
  • storage of the files, unique naming, distribution in case of cluster deployment
  • file download
  • linking the uploaded assets to our model entities - courses, lectures, assignments...

First phase should just focus on the basic requirements: store the file, link to entity, and download.

In a bigger picture we should consider:
lets take a course presenter. He would like to store presentation assets for every lecture, upload assignments and demo code for students, etc. If there are many files the management might get ugly - he might want to track different versions, revert to older file, etc. Think of the features that dropbox or google drive has. is there a way to integrate any of these services? How about a git repo for every lecture/course?

Lombok vs DTO mappers

ATM the lombok is incompatible with the model mapper we use. Basically, the annotation processor of the mapper does not see any of the getters/setters generated by lombok.
We need to check,what are our options.

Live event management

Once a live event has started, the system should keep students in sync with the presenter/lector. E.g. when presenter switches to next slide, the application should switch to next slide on all browsers for students. To do this, we need a robust websocket mechanism, that would manage the live event.

Goal:
Define a component - presumably CDI bean, that gets created once the event starts, store info about all connected peers - presenter, students, allow receiving messages from clients(switch to next slide, question asked, content change....) , allow sending broadcast messages(e.g. to all connected students).

Research: pub/sub at scale, Jee websockets, custom websocket server, etc.

Evaluate voice streaming/broadcasting technologies

what we need:

  1. record sound input of the presenter
  2. livestream the sound to connected clients

Criteria for evaluation:

  • scalability
  • support across browsers/devices
  • reliability

Possible search tags: binaryjs, hls, webrtc

add common Traceable entity and lifecycle interceptor

Traceable superclass

  • Create a mapped superclass for all entities, that would provide information about creation time, update time, creation user and update user, with auto generated Long id
  • use the existing DB package
  • pick a suitable, preferably short name, .e.g. Traceable, Auditable,etc
  • do a research on how is this common requirement usually done

JPA lifecycle listener

  • create a JPA entity listener, that automatically adds/updates the creation/update timestamps of entities on corresponding JPA events
  • set the creation/update user using either CDI principal bean, or javax.ejb.EJBContext.getCallerPrincipal (you need to do a lookup for this)
  • make sure no NPE is thrown
  • add this listener to the superclass

test case

In test code, prepare a test case for this feature, crate a test entity, implementing your Traceable superclass and try to save it with em.persiste/merge. Test that the interceptor creates the timestamps...

create domain model for Courses & Lectures

We need to prepare a domain model for Lectures. Right now we need just the few basic entities, that we will expand later. The exact entities are up to you, but I would suggest something like this for start:

  • Course/Series - name, description, tags, author, type(webinar,lectures,etc..),
  • Lecture - name, desc, order in course, etc
  • Comment - comment for lecture or course so two FKs, plus some text,...
  • Question - questions that can be asked during lecture, title, type of question, audience(everyone or lecturer only)
  • Answer - question Id, text, approved,...

Also create DAO classes as @Stateless no-interface session beans extending DAOService from #16.

Do not worry about the audit attributes - creation user, date etc as these will come from parent class once #2 is implemented.

Test cases for rest endpoints

The unit tests for DB layer seem to work fine, however we do not have any tests for REST api. Any suggestions how to implement them?
Goals:

  • easy to write
  • low boilerplate code
  • possibility to define test data(json), etc

Dockerize the backend componet

In order to ease the devops, our app should be distributed as a docker image.
Goal: 1st phase
define a simple docker file, that extends some well know image(redhat wildfly images, centos, ubuntu, etc...), add JVM, wildfly and our backed app as war producing a single Docker image. Document this and test.

2nd phase:

  • extract the DB part to another container
  • link the wildfly and db container
  • automatically build the docker image(e.g. via maven....)
  • optimize the container(evaluate micro linux distributions), security and port binding

create domain model for Users & security

Create entities for Users/members and security tokens.
Things to consider:

  • we want to support login via social accounts - therefore model needs to support some links to google, facebook, twitter,etc profiles
  • each user can have multiple tokens assigned, read something about jwt , java libraries for jwt
  • tokens should have a limited validity e.g. 6 hours, etc.
  • if password are stored in DB, they should be stored in secured way(research some robust hash methods, viability of login modules in Wildfly, DB support)
    Also create DAO classes as @Stateless no-interface session beans extending DAOService from #16.

CDI setup with producer for common stuff

CDI

  • Configure CDI , so that only annotated classes are discovered(see CDI spec, beans.xml)
  • implement a producer class that is able to produce useful beans - right now : slf4j Logger, Entitymanager

optional - CDI extension that lists all beans

If you want , implement a portable CDI extension that would list all available beans during app startup and log them to console. Make it enabled/disabled based on some system variable, e.g. NLIGHTEN_CDI_DEBUG=true

setup arquillian tests

setup the arquillian tests

  • add required resources to enable test in managed widlfly container - arquillian config
  • add a basic Arquillian enabled test class - configure shrinkwrap deployment, and a simple test case, that just verifies if everything has been setup correctly

optional - create a separate profile, for running test cases - server container in Debug mode

Create a new arquillian container that would add required java arguments to the server, so that it listens for debugger connection.
Create a maven profile, that would turn on this arquillian profile.

setup i18n support

i18n utility

  • implement an i18n utility, that is able to match Enum values to java properties files and provide translations based on Locale.
    Example String message = I18nUtil.translate(MyCoolEnum.ERROR_DUMB,"EN")
  • implement resource bundle loading based on the FQN name of the enum key and locale
  • add support for optional parameters - client can supply an optional array or params that should be interpolated to the message
  • define a format, in which the keys of resource bundle have to be created .e.g. CamelCase, CONSTANT_CASE,... and how would it match the Enum Keys.
  • suggest naming convention for Resource enums, packages..
  • create a simple Junit test case for this functionality - in src/main/test prepare a test enum, test properties and test the results.

Email notification service

we will need an email notification service for many use cases within the app.
Our requirements:

  • ability to send emails in different languages
  • html based email templates
  • easy to use, fast

basically the solution should have two parts: a robust templating mechanism(research available templating libs[freemarker, thymeleaf, moustache...] and make a suggestion) and a business service that will send the email based on template, variables and language.
have a look around the interwebs, hwo do others solve it, what are some chalanges in html email messages, template engine benchmarks.... any suggestions are welcome.

prepare the repo for Openshift deployment

The idea is to setup a staging env on openshift public cloud. Create a new account on openshift, add new remote repo and perform the necessary changes in mvn build to get it working. First step should be to just get it deployed on openshift wildfly cartridge without any errors.

Services and REST api for webinar schedule

We have a model for courses and lectures. Now we need to extend it to support scheduling of live events (webinars, etc).
The goal is to:

  • create entities required for scheduled lectures/webinars - link to actual course/lesson + date, and other info
  • create DAO services, REST api for operations on these schedule objects
  • allow users to signup for a scheduled lecture (a simple list of user ids should suffice)
  • extend existing REST api to also return scheduled live events for certain lecture

DB evolutions tracking

After the app gets deployed to some non-dev environment, the DB schema and data will no longer be generated. In order to automate the deployment process, we need to employ some kind of DB evolution mechanism.

Goals:

  • evaluate existing options and frameworks for DB evolution
  • suggest a deployment procedure, how the changes gets applied
  • suggest a development discipline - how should developers add changes
  • optional: how to ease the process of change tracking(compare JPA schema to DB, etc...)

Research tags: flywheel, liquibase, JPA scheme gen, blue-green deployments, ...

setup configuration framework

config fw

  • research existing options for application configuration, conventions and ideas
  • implement a simple Service/static class/whatever that is able to return configuration in for mof Java objects (ConfigPojo)
  • in the config service, fill the ConfigPojo attributes with values from some source - e.g. system property, values of java properties file, json file based on some algorithm. Example. e.g. try to find a file with same name in classpath and deserialize as json, or use reflection to find proeprty key with the same name as java attribute in a property file with the same name as ConfigPojo, et.c
  • create junit test case for this
  • think about supporting multiple environments, default values, exception handling if config files/properties not defined, update of values runtime
  • add debug messages during construction of ConfigPojo - where do the values come from, how are they mapped...

Add interceptor for logging method invocations

method interceptor

  • create interceptor and required binding, that would log start and end of execution of every method on beans that have this interceptor.
  • log bean class, method name and result type,
  • if method executed correctly log an OK finish message, with execution time in seconds and ms
  • if method failed with exception, log a FAILED message with execution time in seconds and ms and Exception name
  • optional: make the verbosity configurable via annotation parameters of the interceptor binding annotation

setup jaxrs

jaxrs setup

  • setup a JAXRS activator, that adds /rest/v1 application path
  • create a simple interceptors that log all URLs and beans/methods of invoked services - both request and response
  • Log HTTP method, URI, and for response- their HTTP status
  • create a APIStatus endpoint - JAXRS resource that provides health check for clients, .e.g. /rest/v1/apistatus that returns a JSON object with current time, and Health status message, e.g.
{
  "status" : "OK",
  "serverTime" : "12-12-2015 0:00:00"
}

optional - create debug filter, logging data sent/received by services

if you want create a debug filter that logs whole body of POST/PUT requests as string to the console.
Only enable this if a specific system param is set, e.g. NLIGHTEN_REST_DEBUG_REQUESTS=true

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.