Search in sources :

Example 1 with OrientDatabase

use of com.bluenimble.platform.plugins.database.orientdb.impls.OrientDatabase in project serverless by bluenimble.

the class OrientDatabasePlugin method init.

@Override
public void init(final ApiServer server) throws Exception {
    weight = server.weight();
    Feature aFeature = Database.class.getAnnotation(Feature.class);
    if (aFeature == null || Lang.isNullOrEmpty(aFeature.name())) {
        return;
    }
    feature = aFeature.name();
    // add features
    server.addFeature(new ServerFeature() {

        private static final long serialVersionUID = 2626039344401539390L;

        @Override
        public Class<?> type() {
            return Database.class;
        }

        @Override
        public Object get(ApiSpace space, String name) {
            return new OrientDatabase(OrientDatabasePlugin.this.acquire(space, name), tracer());
        }

        @Override
        public Plugin implementor() {
            return OrientDatabasePlugin.this;
        }

        @Override
        public String provider() {
            return OrientDatabasePlugin.this.getName();
        }
    });
    if (Orient.instance() != null) {
        Orient.instance().removeShutdownHook();
    }
}
Also used : ServerFeature(com.bluenimble.platform.server.ServerFeature) ApiSpace(com.bluenimble.platform.api.ApiSpace) OrientDatabase(com.bluenimble.platform.plugins.database.orientdb.impls.OrientDatabase) JsonObject(com.bluenimble.platform.json.JsonObject) Feature(com.bluenimble.platform.Feature) ServerFeature(com.bluenimble.platform.server.ServerFeature) Plugin(com.bluenimble.platform.plugins.Plugin) AbstractPlugin(com.bluenimble.platform.plugins.impls.AbstractPlugin)

Aggregations

Feature (com.bluenimble.platform.Feature)1 ApiSpace (com.bluenimble.platform.api.ApiSpace)1 JsonObject (com.bluenimble.platform.json.JsonObject)1 Plugin (com.bluenimble.platform.plugins.Plugin)1 OrientDatabase (com.bluenimble.platform.plugins.database.orientdb.impls.OrientDatabase)1 AbstractPlugin (com.bluenimble.platform.plugins.impls.AbstractPlugin)1 ServerFeature (com.bluenimble.platform.server.ServerFeature)1