GithubHelp home page GithubHelp logo

flaviof / fabric8-persistence-hibernate-postgres Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pires/fabric8-persistence-hibernate

0.0 2.0 0.0 163 KB

Simple Fabric8 + E-OSGi persistence (Aries + Hibernate with Postgres and JSON parameters) + CXF REST service demonstration code.

License: Apache License 2.0

Java 100.00%

fabric8-persistence-hibernate-postgres's Introduction

fabric8-persistence-demo

Fabric8 + E-OSGi managed persistence (Aries + Hibernate) + REST service demonstration code.

Pre-requisites

  • JDK 7
  • Maven 3.1.0 or newer

Build and install

mvn clean install

Provisioning

Installation and initial configuration

  • Download latest build for fabric-karaf and extract it. (tested on fabric8-karaf-1.0.0.redhat-348)
  • Extract it
  • cd to the newly extracted folder
  • Define default administrative user (login: admin, password:admin) by uncommenting the last line of etc/user.properties
  • Start Fabric
bin/fusefabric

If everything goes well, you should get a Fabric shell that looks like this:

Please wait while Fabric8 is loading...
100% [========================================================================]

______    _          _      _____
|  ___|  | |        (_)    |  _  |
| |_ __ _| |__  _ __ _  ___ \ V /
|  _/ _` | '_ \| '__| |/ __|/ _ \
| || (_| | |_) | |  | | (__| |_| |
\_| \__,_|_.__/|_|  |_|\___\_____/
  Fabric8 Container (1.0.0.redhat-340)
  http://fabric8.io/

Type 'help' to get started
and 'help [cmd]' for help on a specific command.
Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown this container.

Open a browser to http://localhost:8181 to access the management console

Create a new Fabric via 'fabric:create'
or join an existing Fabric via 'fabric:join [someUrls]'

Fabric8:karaf@root>

Start Fabric Ensemble

fabric:create --clean --wait-for-provisioning

Define our own profile

profile-create --parents example-quickstarts-rest persistence-example
profile-edit --repositories mvn:com.github.pires.example/feature-persistence/0.1-SNAPSHOT/xml/features persistence-example
profile-edit --features persistence-aries-hibernate persistence-example
profile-edit --bundles mvn:com.github.pires.example/datasource-hsqldb/0.1-SNAPSHOT persistence-example
profile-edit --bundles mvn:com.github.pires.example/dal/0.1-SNAPSHOT persistence-example
profile-edit --bundles mvn:com.github.pires.example/dal-impl/0.1-SNAPSHOT persistence-example
profile-edit --bundles mvn:com.github.pires.example/rest/0.1-SNAPSHOT persistence-example

Create and run new container with newly created profile

container-create-child --profile persistence-example root test

Testing

In Hawt.io UI, go to API tab (in the parent container), check the host and port where UserService is available and point it down. Test the REST endpoint as you wish!

REST API (JSON)

Create new user

PUT /user

Example JSON:

{
    "name":"fferreira",
    "properties":{"value":"{\"string1\":{\"mandatory\":false,\"value\":\"teste\",\"type\":\"string\"},\"num1\":{\"mandatory\":false,\"value\":123,\"type\":\"number\"}}"}
}

Count users

GET /user/count

List users

GET /user

Troubleshooting

If rest bundle is waiting on UserService, it's because dal-impl bundle is waiting on hibernate-osgi to announce its availability. Restart hibernate-osgi bundle, et voilá!

Differences from original repository

  • Working with postgreSQL
  • Working with a JSON object as PostgreSQL column

fabric8-persistence-hibernate-postgres's People

Contributors

pires avatar

Watchers

 avatar  avatar

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.