Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/orienteerbap/camel-orientdb

Camel adapter for OrientDB
https://github.com/orienteerbap/camel-orientdb

adapter camel integration orientdb orienteer

Last synced: 16 days ago
JSON representation

Camel adapter for OrientDB

Awesome Lists containing this project

README

        

# camel-orientdb
Camel component for OrientDB. For Camel since ***2.17.6*** and later.

##Maven

For injecting Maven depedency use this code:

```

org.orienteer.camel.component
camel-orientdb
1.0-SNAPSHOT

```

##Initialization

DB connection variables can be set using CamelContext properties, like
```
context = new DefaultCamelContext();
Map properties = context.getProperties();
properties.put(OrientDBComponent.DB_URL, dbSettings.getDBUrl());
properties.put(OrientDBComponent.DB_USERNAME, session.getUsername());
properties.put(OrientDBComponent.DB_PASSWORD, session.getPassword());
context.setProperties(properties);
```

Also can see http://camel.apache.org/properties.html

Default properties names is

```
DB_URL="orientdb.url";
DB_USERNAME="orientdb.username";
DB_PASSWORD="orientdb.password";
```

But it can be change

##URI format

The OrientDB component using following endpoint URI notation

```
orientdb:[OrientDBSQLQuery][?options]
```

And using OrientDB query format with minor changes:

- Instead ***?*** used ***:#*** for anonymous input parameters. Named parameters using OrientDB notation (:name)

Example:
```
orientdb:select from testTable where name=:#
```

Some URIs may not use queryes, only options, like:

```
orientdb:?preload=true&makeNew=true
```

This endpoint just load input Map`s and trying to create new objects from them.

##Options

|Name |Kind |Group |Required |Default |Type |Enum |Description|
|---|---|---|---|---|---|---|---|
|sqlQuery| path |common |false | |java.lang.String | |Sets the query to execute
|catalogsLinkAttr| parameter| common| | orienteer.prop.name| java.lang.String | |Name of your custom attribute, linked to catalog class and containing name of field in this class, associated to name of element of this class
|catalogsLinkName| parameter| common| | name| java.lang.String| |If you not use "catalogsLinkAttr", you can set field name of "name" element in catalogs class directly here
|catalogsUpdate| parameter| common| | true| boolean| |If you set "catalogsLinkAttr" or "catalogsLinkName", catalogs may be autoupdated, if "catalogsUpdate" = true. If is that - in catalogs classes may be created empty elements with new "name" field values.
|classField |parameter |common|false |class |java.lang.String | |Your "@class" renamed to classField value
|fetchAllEmbedded |parameter |common|false |true |boolean | |Fetch all embedded(not linked) objects, ignore "maxDepth". Only for "map" type.
|fetchPlan |parameter |common|false | |java.lang.String | |Set fetch plan (view OrientDB documentation, like http://orientdb.com/docs/2.0/orientdb.wiki/Fetching-Strategies.html)
|maxDepth |parameter |common|false |0 |int | |Max fetch depth. Only for "map" type
|outputType |parameter |common|false |map |org.orienteer.camel.component.OrientDBCamelDataType |map/object/json/list |Output data type of single row.
|recordIdField |parameter |common|false |rid |java.lang.String | |Your "@rid" renamed to recordIdField value
|inputAsOClass |parameter |consumer|false | |java.lang.String | |Rewrite "@class" field value in root document(s)
|makeNew |parameter |consumer|false |true |boolean | |Clear ODocuments RID`s in PRELOAD phase BEFORE save.Works only if ***preload=true***
|preload |parameter |consumer|false |false |boolean | |Trying to save ODocument from input data BEFORE query

##Input

***NOTE*** All first-level lists split to elements and OrientDBSQLQuery evals for EVERY element. If you need process only one parametrized element, use Map, ODocument or List with one element in

|Type|Transfer to query input as|Can be preloaded|
|---|---|---|
|`ODocument`|`Map`|true
|`Map`|`Map`|true
|`List`|`Map`|true
|`List>`|`Map`|true
|`List`|`Object`|false

##Output

***NOTE*** All output conversions are recursive, or convert output into flat structures

***IMPORTANT NOTE*** If result of sql query is list and before you sent List(as example) to input, then results of all queries will be joined into one big List

|outputType/query result|ODocument|List|Object|
|---|---|---|---|
|map|`Map`|`List>`|Object
|object|`ODocument`|`List`|Object
|json|`(String)OrientDB Json`|`List<(String)OrientDB Json>`|Object
|list|`List`|`List>`|Object