These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

CrestJ java framework

Author
Salgare
Center for Advanced Studies
Gallente Federation
#1 - 2016-07-08 19:03:25 UTC  |  Edited by: Salgare
Design/implementation phase --- join on in!
Java Framework providing:

OAuth support

  • abstract OAuth implementation
  • Wicket specific OAuth implementation layer
  • Crest Wicket specific OAuth implementation layer

CoreController support

  • abstract CoreController layer
  • crest specific CoreController implementation
  • custom app CrestController extension.

View Support

  • crest wicket specific extension layer
  • custom app wicket implementation

Model Support

  • eve Service Provider Interface (SPI) Cache
  • pure java interfaces declared for all xml-api and json api's, implemented by public side of SPI
  • eve clients provide the service implementation of the SPI.
  • read cache (updated per endpoints cached time)
  • write through cache (for those sweet new crest api's, keep em coming CPP!)
  • abstract DataAccessor - pure interfaces
  • abstract Crest specific DataAccessor implements/extends abstract da - pure interfaces
  • postgres implementation of crest da
  • DA interfaces for SDE

Eve clients (feed Eve api client cache)

  • async xml api client with full implementation of all endpoints.
  • async crest api client with full implementation of all endpoints.

Event Support

  • registration for OAuth state event listeners (authenticated, signedOut, refreshed)
  • registration for DataAccessor state event listeners (up/down)
  • registration for client state event listeners (up/down)
  • registration for cache event listeners (updated, objectChanged)

Access Control Lists (ACL)

  • abstract AccessGroup
  • anonymous AccessGroup implementation
  • user AccessGroup implementation
  • director AccessGroup implementation
  • da's to support custom application Groups
  • abstract Rights
  • da's to assign rights to users.
  • public side of SPI Cache declares required AccessGroups
  • da's to share user access data with others.

RabbitMQ and PHP Bridge
interfacing to other popular web-tier languages


This is opensource, with no expectations of payment.
see here for details on source

Open for suggestions
Salgare
Center for Advanced Studies
Gallente Federation
#2 - 2016-07-08 19:03:37 UTC  |  Edited by: Salgare
reserved


Cool
Salgare
Center for Advanced Studies
Gallente Federation
#3 - 2016-07-13 02:44:11 UTC  |  Edited by: Salgare
Major decoupling has occurred.

Personal utils used in Crestj
https://github.com/timpanogos/ccc-common

  • ccc-tools jar - generic utilities
  • ccc-db jar - generic DataAccessor interfaces/base classes
  • ccc-oauth jar - generic OAuth for v1/v2 support (uses com.github.scribejava)
  • ccc-wicket jar - generic wicket base application utilizing ccc-oauth
  • shadowbuild - I use some parent poms for 3rd party dependency management, see buildParents.bat


Crestj
https://github.com/timpanogos/crestj

  • crest-core jar - ccc-oauth contains a generic CoreController which is extended here
  • crest-da jar - implements/extends ccc-db - Declares pure Data Accessor interfaces for frameworks persistence needs.
  • crest-pg-da jar - Postgres implementation of crest-da
  • crest-wicket.jar - implementation/extends ccc-wicket's base application class.
  • crest-web - Tomcat/jetty ready .war file.
  • need-d - Leaf wicket application layer, provides custom views and custom controller as needed.


Thus OAuth, Web Application framework, Controller (Model coupling in controllers) and DataSource's have all been abstracted and loosely coupled allowing for the likes of

Provide your own OAuth, utilize the frameworks model, view and controller
Provide your own view (Web Application framework) and likely OAuth and utilize the frameworks controller/DataSources

I have no experience with Python, but understand JPython is basically identical and can interact with java classes. I would love to see a JPython framework that is already providing OAuth and view hook up with this CrestController class and see if it can't provide your model. All I would need of you is a Base20ClientInfo implementation that provides the framework with the current SSO access_token. Your interface would then all be found in the CrestController
Salgare
Center for Advanced Studies
Gallente Federation
#4 - 2016-07-13 03:49:20 UTC
op updated
Salgare
Center for Advanced Studies
Gallente Federation
#5 - 2016-07-19 09:59:35 UTC  |  Edited by: Salgare
This is a development box and so will be up/down and will not be a permanent situation, but if anyone wants to see the eve SOS in action feel free.

http://ec2-23-20-106-130.compute-1.amazonaws.com
http://23.20.106.130

The authentication is a dual purpose situation. First it distinguishes what pages in the application a user has rights to while they are interacting with the application. Currently the AccessGroup db table provides these groups:

  • Anonymous
  • User
  • Directors
  • extensible for custom

There is also a Rights table which currently only has the following right

  • SharedRight

Directors will be able to create other custom groups and assign capsuleer's to those groups. Capsuleer's will be able to assign ShareRights to other capsuleers or groups that allow those individuals access to their personal (User group) information.

This trickles over to actual access rights to the public API side of the SPI Cache, verses character and corporation private. Everyone is a member of the Anonymous group (public data). An authenticated capsuleer is in the User group (character/corp). Currently at least one Director has to be configured at installation/startup to provide an individual with "Admin" rights to go from there.

I currently have a single properties file (simple name/value pairs) for configuration. When I started I only had a single app per installation in mind. For example, the applications required scopes are declared here. The Director/s are also declared here. As the cache evolved in my design, and my discovery that RabbitMQ has implementations for all of the languages our group use is available, I realized a big buy here is for multiple applications to share the cost of the server. Thus I will look at how to break up these groups/rights, and capsuleers/directors partitioned by application, and make these accessible to the app for their own restriction purposes.

So, future, not only will this be able to provide SSO/access_token and fresh async data pushed to the application but a ACL system for the application to leverage and for individual capsuleers to share with others (alts will love it)

Do note if you authenticate the system at this time, it will capture your refresh_token in the db and can/currently will continue to refresh any endpoints that are accessed by a given CharacterID. You can go to the following url to invalidate this refresh_token ... but the db is super volatile and will continue to undergo change anyway (regularly blown away).

Give it a try.
foxjazz
Center for Advanced Studies
Gallente Federation
#6 - 2016-07-19 18:11:51 UTC
Hi, I installed netbeans and clone the app. Should I be using a different ide to look at the code?
Salgare
Center for Advanced Studies
Gallente Federation
#7 - 2016-07-19 19:37:04 UTC  |  Edited by: Salgare
foxjazz wrote:
Hi, I installed netbeans and clone the app. Should I be using a different ide to look at the code?



I need to get going on some markdown doc!

much prefer Eclipse, get it as I'm familiar and can help you.

1. https://eclipse.org/downloads/ run the download, its an installer, pick "Eclipse IDE for Java EE Developers"
2. https://maven.apache.org/download.cgi
3. https://tomcat.apache.org/download-70.cgi (don't get v8 or 9 if you want to play with the PHPBridge)
4. https://www.postgresql.org/ postgresSql

for the tomcat, unzip it anywhere ... I happen to gather this sort of stuff at c:\tools\* but it does not matter. Also, you will only need this if you plan to run/single-step debug. You will only need the maven if you want to build/run it.

These instructions will get you into the source quickly as any IDE has it's painful learning curve.
I like short paths, all at the bottom. Do something similar. If you follow this pattern it will make eclipse life better long term. ws stands for WorkSpace in eclipse.

First create something similar to the following directory structure
c:\ws
c:\ws\eclipse
c:\ws\ccc-common
c:\ws\crestj

git tools don't like cloning into folders that have anything in them. Copy the two that you cloned into their corresponding ccc-common and crestj folders in the above structure and delete them from where you originally cloned them out to.

When you first fire up eclipse it's going to ask you for a "Workspace" folder, set it to c:\ws\eclipse


In eclipse, hook it up with your git clone as follows
File->new->project... pick "Java Project"
Right under Project Name there is a "Use default location" check box, de-select it and browse to your git clone locations.

There are the two git repositories, each with multiple "modules" or "projects" or "jars" these are synonymous terms. So with the above mentioned browse to, select say ccc-db. Repeat this process for all of the projects in the two repositories.

c:\wsc\ccc-common (has .git repo)
c:\wsc\ccc-common\ccc-db (a jar - select me)
c:\wsc\ccc-common\ccc-oauth (a jar - select me)
c:\wsc\ccc-common\ccc-tools (a jar - select me)
c:\wsc\ccc-common\ccc-wicket (a jar - select me)

I need to get scratch.jar out of there at some point, its for junk playing around right now.

c:\wsc\crestj (has .git repo)
c:\wsc\crestj\crest-core (a jar select me)
c:\wsc\crestj\crest-da (a jar select me)
c:\wsc\crestj\crest-pd-da (a jar select me)
c:\wsc\crestj\crest-web (a .war (special jar) select me)
c:\wsc\crestj\crest-wicket (a jar select me)
c:\wsc\crestj\nee-d (a jar select me - skeletal application that sparked this slow, overly designed nightmare)

longer term in the "Project Explorer" tab the cryptic small graphics at the top, check out the triangle and "working sets" to better organize these two sets.

At this point you should have 12 eclipse projects which are typed java and may or may not have realized they are also of type maven (they have a pom.xml in them). Look close at the folder icons for each of the 12, there should be an 'm' upper left corner and 'j' upper right corner. Select any/all that don't have the 'm', right click and select "configure->maven

Everything is going to be red at this point (not building), but you will have full IDE helps ... F3 any selected item jumps you to the declaration of that item, etc. watch for the various navigational mnemonics and accelerators in the right click pull downs.

Ok, if you want to build and get rid of all the red. I use ccc-common for a lot of other personal/work stuff, thus I've used an advanced feature of maven for dependency version management that utilizes parent poms. You need to get these parents loaded into your local .m2 repository. To do this execute the batch file at:

c:\ws\ccc-common\shadowbuild\parents\buildParents.bat install

it will need that install command line parameter.

Ok, at this point you have two build systems, the maven command line build, which is used for final deployments, this is the master. Then you have Eclipses auto maven build, a subset of the command line which does it's own caching of the .m2 repository classes/jars for IDE time dependencies etc. Sometimes these two get out of synch, and we have definitely confused eclipse at this time.

To fix this, right click on any of the projects (i.e. crest-core) select "maven->update project ..." and hit the "Select All" button and then ok.

All the red will drop.

if it does not drop, I have a cart-before the horse situation in the build poms that I'm not sure resolve in a clean environment. Holler if that's the case.

later, you are real close here to being able to single step servlet code running on the tomcat server, so holler if/when ready to play with that.
Pestoya
Caldari Provisions
Caldari State
#8 - 2016-08-28 08:34:40 UTC
Good job!

The demo servers you link are unavailable, where we cann see this in action ?
Salgare
Center for Advanced Studies
Gallente Federation
#9 - 2016-08-28 23:35:34 UTC  |  Edited by: Salgare
Pestoya wrote:
The demo servers you link are unavailable, where we cann see this in action ?


I had high hopes for my pretty little snowflake at one point, see:
https://forums.eveonline.com/default.aspx?g=posts&t=488241&find=unread

The up thread demo links were on an ec2 instance on a work account which I can not leave running indefinitely.

However, this has not changed any of my design/implementation plans. Work and health got intense the last few weeks so I have not gotten much done. I have just recently re-engaged and have the README.md's on the repo's in place and have been working on dynamically walking the crest call groups for a solid dynamically driven client implementation driven from json schema.

Work continues ... slowly.
Salgare
Center for Advanced Studies
Gallente Federation
#10 - 2016-09-13 02:46:17 UTC  |  Edited by: Salgare
very minor release:

https://github.com/timpanogos/crestj/blob/master/crest-core/config/tq-root-endpoints.json
https://github.com/timpanogos/crestj/blob/master/crest-core/config/sisi-root-endpoints.json

You can use this json as a temporary replacement for the Root server information and endpoint discovery which is currently very incomplete.

This json is a hybrid mix of the all of the endpoints that should be reported by an HTTP: GET request to the root and HTTP: OPTIONS request to endpoint. As far as I could discover this covers every CREST endpoint currently available on sisi.

This is the structure of the json:

    
    Endpoints
         long userCount;
         String serverVersion;
         String serverName;
         String serverStatus;
         Endpoint root;

    Endpoint
        String name;
        String cuid; // optional POST's assigned here 
        String ruid; // optional GET's assigned here
        String uuid; // optional PUT's assigned here
        String duid; // optional DELETE's assigned here
        String url;
        String relative;
        int cacheTimeout;  // -1 if not determined yet
        Array[Endpoint] children;


enjoy