Skip to content

Latest commit

 

History

History
188 lines (152 loc) · 6.89 KB

README.md

File metadata and controls

188 lines (152 loc) · 6.89 KB

               ReflectWork

               version: 0.0.2

What is it?

is a Framework, development with Java using the API of Reflection. You can create classes and methods in one package, and methods and objects has been called dynamically

What's the point?

To manage an application using Jsons

               How to uses this Framework

Requeriments

* Postman
* Apache Tomcat
* Java EE
* IDE with Java EE
* PostgreSQL

1. Create Database

This is a representation of the database

Please create a new database with some name in PostgreSQL, after this, please execute this commands in SQL:

Users
CREATE TABLE users
(
    id_users serial NOT NULL primary key,
    name_users varchar,
    surname_users varchar,
    email_users varchar UNIQUE,
    password_users char(64),
    creationtime_users varchar
)
Profile
CREATE TABLE profile
(
    id_profile serial NOT NULL primary key,
    username_profile varchar UNIQUE
)
Profile Users
CREATE TABLE users_profile
(
    id_users_profile serial NOT NULL primary key,
    id_profile integer NOT NULL,
    id_users integer NOT NULL,
    FOREIGN KEY (id_users) REFERENCES users(id_users)
    FOREIGN KEY (id_profile) REFERENCES profile(id_profile)
)
Object
CREATE TABLE object
(
    id_object serial NOT NULL primary key,
    name_object integer NOT NULL UNIQUE
)
Method
CREATE TABLE method
(
    id_method serial NOT NULL primary key,
    name_method integer NOT NULL,
    id_object_method integer NOT NULL,
    FOREIGN KEY (id_object_method) REFERENCES object(id_object)
)
Permissions
CREATE TABLE permissions
(
    id_permissions serial NOT NULL primary key,
    id_method_permissions integer NOT NULL,
    id_profile_permissions integer NOT NULL,
    FOREIGN KEY (id_method_permissions) REFERENCES method(id_method)
    FOREIGN KEY (id_profile_permissions) REFERENCES profile(id_profile)
)

2. Download Project

Download this as a zip or clone in your IDE workspace, if you download please unzip this in your IDE workspace. After, open your IDE and import project of projects existing in your workspace

3. Configure Project

Enter in the folder Config and create the .properties files for config_db and config_pool, you need to create this files:

config_pool.properties
maxconnections={number};
hops={number};

config_db.properties
db.driver=org.postgresql.Driver; // to use PostgreSQL
db.url=jdbc:postgresql://localhost:5432/{YourNameDB};
db.username={YourUsernameDB};
db.password={PassofUsernameDB};

Very important: The database needs the previous tables

4. Runs a Server

In your IDE with Java EE, open the project and create a server in servers tab. Use a apache tomcat 8.0 or higher, and add the dynamic web project in server. after, start the server.

5. Test Server

Open postman and create new request in POST method to this endpoint: localhost:8080/TeamBackendJava/Dispatcher or localhost:8080/backend_java/Dispatcher, next go to body raw, and write Json, click in send and wait responses.

If the response is a JSON. You're using the Framework
Else if the response is a status 500 with html, servers finds a big bug
Else the response is a status 404, server is turn off or isn't the endpoint

The default response with json empty is it

               Some Examples



      First, you needs register and login to uses dynamic objs and methods



      Next, you have session. The servlet needs this params:



      Oh well ! Let's try, make a obj and method and restart the server



      But... If you try to uses this method, server says this:



      You need give permissions in SQL, like this:



      Note: The objects and methods refresh in DB with server restart



      And repeat process for method, next, restart the server



      Ok, now you have permissions, good !



Types of paramateres supported:

string
byte
double
char
Character
boolean
ArrayList
int
Integer
float




Collaborators of the Backend:

luisnvf7 -> Luis Villalobos
fannyzhl -> Xiao Zhao
elimora -> Eli Mora
TheSuperHack -> Heberto Urribarri
rsulbaranc -> Ricardo Sulbaran
pablocastillo123 -> Pablo Castillo
mdjfs -> Marcos Fuenmayor